Silverlight project won't enter debug mode - silverlight

My Silverlight project in VS 2010 has stopped entering debug mode. Even if I set a breakpoint in the constructor of the Application class, it refuses to hit any breakpoints. My other projects are still fine, but I can't find any setting that may have accidentally gotten changed to keep me from debugging. What could be going on?

Open the properties of the associated Web Project. Select the Web Tab. Scroll to the bottom and in the "Debuggers" section make sure "Silverlight" is Checked.

Not sure what happened, but here's what got it working again.
I changed it to Release mode, compiled it. Closed and restarted VS, changed it back to Debug mode, ran it and breakpoints hit again.

Make sure the dropdown in the toolbar is set to Debug and not Release

While Attaching the process please attach w3p.exe and iexplorer instance of Silverlight this should resolve your issue.

Related

Debug XBAP hosted in WPF Application

I have a WPF Application (say, WPF.exe) with multiple tabs. In one of the tabs, I display a *.xbap using: WebBrowser tag.
<WebBrowser Source="c:/PublishedWebSites/Test.xbap"/>
When I start WPF.exe, I am able to attach debugger to any other UserControl but not to my XBAP. I also tried attaching my XBAP to PresentationHost.exe process which was started when I click on the browser tab.
The break points are not hit in XBAP project, though I verified that when I publish the XBAP, I oublish *.pdb files as well.
Could anyone tell me what I am doing wrong here?
Thanks,
RDV.
I could debug. Steps:
1. Compile and Publish XBAP. DO NOT change anything after publishing.. in case you do.. republish it.
2. Ensure there are no PresentationHost.exe processes running.
3. Run the WPF application. Launch XBAP (as one of the tabs ..in my case).
4. Debug->Attach to process-> Connect to PresentationHost.exe=> ensure that you select the correct 32 vs 64 version (i think this was my mistake).
Thanks,
RDV

Forms not showing changes when run in visual studio 2008

My forms in my vb.net programs in visual studio are not showing the changes I make on them when I run the application. The were working before but eventually just stopped with nothing really done to stop them. I am making changes like changing background color, adding controls like buttons but they only show in the design view but do not show when I run the program. I've tried to clean and build but still showing the same problem. Could someone tell me why this happens and how a fix can be achieved? Thank you
It is likely because you have your build mode set to "release". When you run the debugger it uses the "debug" version. Change your build mode to "debug" and you should see the changes.
Delete all the file from \bin\Debug and build the application again. It should work fine. And make sure you are on debug mode

Silverlight debugging; not attaching process

I use Google Chrome as my default browser but prefer to use Internet Explorer for debugging Silverlight applications. I therefore set my web project properties thus and check the Silverlight debugger option.
This has worked fine for ages but since returning from vacation I find that the iexplore.exe process running silverlight is no longer attached to the debugger and I must attach it manually. When not debugging my app I can check the Debug | Attach to Process... dialog and see that there are no instances of iexplore.exe running. Then I hit F5 and start a debug session and look again, after which there are two instances, one of which is attached, but not the one running Silverlight. Once I attach the other too, debugging works fine and I can hit breakpoints and step through the code with no problem.
Any ideas on what I'm missing to get the debugger attaching to the correct process would be appreciated.
Chrome is my default OS browser, but I use IE for SL debugging.
What I do is find the ASPX page in the hosting Web project in the solution view of Visual Studio. Right-click the file and select Browse With. You'll be presented with a dialog. Select IE from this list of Browsers and press the Set as Default button. I then cancel out of this dialog. Now when VS starts debugging it uses IE! You'll need to undo your "Start external program" debugging options in the project (switch back to Current/Specific Page).
VS will occasionally "forget" this setting and switch it back to Chrome. Just repeat this process.

Silverlight hangs at 100% loaded

My Silverlight website hangs at 100% loaded. There is no code for it, so far it is just the design in XAML, and it shows up fine in Expression Blend 3. It is the standard "Silverlight Website" project from Blend 3, without any modifications.
When I press F5 to run it, it shows as a 100% loading circle in firefox and never actually shows my app. The loading circle continues to animate as if its doing something.
Note: It worked yesterday, and I havent made very many changes to it since then.
I had this problem in browser, out of browser - even when debugging. Using Silverlight 4 beta.
I hit F5 to start debugging and it never even hit a breakpoint for the constructor of App.xaml.cs.
I knew I'd uninstalled an out of browser app and changed some out of browser settings recently but nothing would tell me the actual problem.
I found in the end if I ran in IE (normally I use Chrome) - then an error icon would be shown in the bottom left - as if it were a javascript error.
Webpage error details
Message: Unhandled Error in Silverlight Application
Code: 2020
Category: ParserError
Message: Invalid Property: OutOfBrowserSettings.
File:
Line: 47
Position: 27
Line: 54
Char: 13
Code: 0
URI: file:///R:/Project/Projece/Bin/Debug/TestPage.html
Well this didn't get me any further - except to tell me something was messed up with OutOfBrowserSettings.
What I ended up doing was creating a new AppManifest.xml. As of Silverlight 4 this is the default AppManifest.xml.
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
I disabled 'create app manifest' and reenabled it. After toggling some of the settings back and forth - and even creating AppManifest2.xml I managed to get it working again.
I switched back to my original AppManifest.xml and it worked.
The point being check any message the browser gives you - and then change things that you don't think will make a difference.
Good luck!
I figured out the problem after looking at the XAML. On the height property of one of my buttons, there was a line break right before the ending quote. Expression blend didn't mark it as an error, and everything showed up fine in design mode.
When I removed the line break, the loading problem was fixed.
My other answer looks quite convoluted compared to this. This may or may not help in this situation but its worth a try:
In Visual Studio :
Click Debug > Exceptions
Click 'Find' and search for XAML
Click the 'Thrown' button next to System.Windows.Markup.XamlParseException
Start your project in debug mode. Any Xaml exceptions will be shown immediately. Check the inner exception sometimes for further information.
I wasted soooo much time before I finally figured this one out!
Here is the answer: http://www.cnblogs.com/101rico/archive/2012/11/14/2769781.html
You can add this: xmlns:Grid="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
This also happens when the Silverlight app requires Silverlight 5, but the user has a lower version installed.
An infinite event loop can cause this problem:
private void myComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
myComboBox.SelectedIndex = 0;
}
If it is an elevated trust application, failing to have the necessary registry settings set to allow its launch can cause the dreaded "100% hang":
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Silverlight
AllowElevatedTrustAppsInBrowser DWORD:=1
AllowLaunchOfElevatedTrustApps DWORD:=1
Open Internet Explorer, go to Tools-> Internet Options->Advanced->click Reset on Reset Internet Explorer Settings-> choose Delete Personal Settings->Click reset
So my problem was, in a data grid, I had a duplicate column name binding to the same column name. So something in the xaml was crazy messed up. Apparently the control I am using had an "Internal Exception" that was not being thrown up on the screen as an error.

WPF XBAP applications blank after second/third deploy?

This has happened repeatedly on various machines in VS2008 and Visual C# 2008.
I create an XBAP appliation.
I click the green arrow and it works.
I click Build/Publish and publish it to either a website or folder, it works.
I make some changes, publish again, and I just get a white screen. Both browsers, can restart, always blank.
It seems to be some kind of caching, etc. Has anyone had this happen to them and found a workaround?
Is the version number incrementing? Right click on the xbap project, go to properties/publish tab, increase the version number and republish.
You can clear the application store using mage -cc command from VS command prompt. Check out this post for more info.

Resources