When I start my Silverlight 4 and 5 applications with debugging in VS 2010, I can set breakpoints in both the client project as well as the server project that serves the application.
On running the app out-of-browser (ie configuring the app out-of-browser and setting it as the startup project) however, the debugger will not be attached to the server any longer, although the server project will still be started correctly.
Is there a way around this problem?
You can set a Launch or Break statement at the location you want to break.
// Will launch a debugger once and will break once
System.Diagnostics.Debugger.Launch();
//Will launch a debugger and break any time the code is hit
System.Diagnostics.Debugger.Break();
Related
I have some Matlab .m files that use a C function I've created.
When Debugging in Matlab, or Visual-Studio, is there any way to run step by step both C and Matlab codes in a way that both Matlab a C variables remain usable for debug?
This addresses only the MSVS half of your question...
The steps to use step-by-step debugging using Visual Studio are outlined here. This is just an except centering around a .dll that is hosted by a pre-existing application. Matlab qualifies as a host application, whether it is also being run in debug mode, or not.
Start debugging from the calling app
The app that calls a DLL can be:
An app from a Visual Studio project in the same or a different solution from the DLL.
An existing app that is already deployed and running on a test or production computer.
Located on the web and accessed through a URL.
A web app with a web page that embeds the DLL.
To debug a DLL from a calling app, you can:
Open the project for the calling app, and start debugging by selecting Debug > Start Debugging or pressing F5.
or
Attach to an app that is already deployed and running on a test or production computer. Use this method for DLLs on websites or in web
apps. For more information, see How to: Attach to a running process.
Before you start debugging the calling app, set a breakpoint in the
DLL. See Using breakpoints. When the DLL breakpoint is hit, you can
step through the code, observing the action at each line. For more
information, see Navigate code in the debugger.
During debugging, you can use the Modules window to verify the DLLs
and .exe files the app loads. To open the Modules window, while
debugging, select Debug > Windows > Modules. For more information, see
How to: Use the Modules window. Use the Immediate window
You can [also] use the Immediate window to evaluate DLL functions or methods
at design time. The Immediate window plays the role of a calling app.
[and so on....]
I have encountered a problem with uVision and Hitex emulator (Tanto2) on a Win10 laptop (fresh install).
My initial setup was UV5.23, I updated to 5.24 and made tentative with 5.25 on Keil's request.
I have a dedicated SDK release for UV5.23, I switched to a new one for UV5.24.
Firmware emulator was reflashed when I was using SDK for UV5.23, and updated when moving to UV5.24
What I can do:
- start UV5, open my project,
- start a debug session on the emulator, load my project, make the first run and stop debug session.
Whatever the release I use, the problem appears when I want to start a second debug session on the emulator. Once I click on the Start Debug, UV5 crashes with this message:
"uVision IDE has stopped working
A problem caused the program to stop working correctly. Windows will ..."
I need to relaunch UV5 to run a new debug session.
The setup using Keil 5.23 and its dedicated SDK release was OK till the end of March.
Since the end of March, the Windows updates that have appeared are: KB4088776, KB4093110, KB4093112, KB890830, KB4099989.
I tried uninstalling KB4099989, but there was no change, the problem is still present.
Is there a link with these updates?
If someone encounters the same problem and was able to solve it, I hear you :-)
The same problem appears on the laptop of my colleague whereas it is working fine before the last Windows update.
Thank you in advance for your help.
This is because of the below issue. If there is a crash in application during dll unload, windows adds an entry in registry to ignore a future unload dll request. So if the application tries to load the dll again within the same session, then the application crashes.
As a workaround goto the below location in registry,
My Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
and delete the unload registry path. Everytime if there is a new crash then the dll will be added back which needs to be removed.
[work around]
I also get crashes when entering debugger session, however I noticed that it occurs only if I click the debugger icon and then leave the pointer over that icon. I have never had it crash if I click and immediately move the pointer away.
I have a VS2015 solution with 2 C# projects. A WPF client, and a Web API server. I set a breakpoint in the Web API code. Then ran the WPF client in debug. The breakpoint icons in the source file changed from solid red dots to red circles. The debugger is not breaking at the breakpoints. What am I doing wrong?
You effectively have 2 applications and you're trying to debug both at the same time which won't work.
Make your API run in IIS then use a separate Visual Studio instance to attach debugging to that process ( you can find it running under w3wp ).
So you can do this effectively with 2 instances of Visual Studio, one for the client and one for the API.
You can also simply open the same solution with a second VS, and run the API from there then have the client hit the api on the same URL as the one being debugged. It is a bit strange to use 2 Visual Studio instances but it does the job quite well.
Use whichever method you're more comfortable with.
I'm not 100% sure, but I think it is probably because you are just debugging the client. I had the same difficulty getting to the code of a WCF service recently. As I understand it (and I'm no expert, so people who know better feel free to correct me if I'm wrong) basically Visual Studio won't peek into the server code while you are just debugging the client. I presume that when you run the client, you also have the server running at the same time?
I think the best way to deal with this is either to start your client, and then attach the VS debugger to the server process (see https://msdn.microsoft.com/en-us/library/3s68z0b3.aspx), or to run both the client and server programs at the same time when you start the debugger (https://msdn.microsoft.com/en-us/library/ms165413.aspx).
Hopefully this helps :)
Having set up my Mac and PC per these instructions, I am nevertheless unable to attach to the process running in OS X.
"Unable to attach to the process. A debug component is not installed."
Anyone seen this before? I've Googled it, turned up nothing.
I got the exact same error message on my machine after I had windows update install a security update for Silverlight on windows. I think the root cause is different versions of the silverlight runtime. I recommend doing the following:
Make sure that both windows and mac have the developer runtime installed, and that it is the same version. The latest ones are here:
http://www.microsoft.com/en-us/download/details.aspx?id=36946
After doing that, relaunch the configuration generating program on OSX, generate a new configuration (top button), and then generate a new PC configuration (bottom button).
Close visual studio, run the configuration exe on windows, and open visual studio.
I followed these steps and was able to get remote debugging working again.
I spent some time debugging a SL3 application with VS 2010 in IE9 beta today and noticed a few quirks. Sometimes when launching the Silverlight app in VS it fails to load in the browser, but refreshing with F5 tends to fix the problem. Also, there are sporadic scripting errors that pop up a debug dialog - these also seem to be fixed by refreshing the page. Has anyone run into these problems and found a fix?
EDIT: My most prevalent error is:
Error: ASP.NET Ajax client-side framework failed to load.
I don't understand why, but someone without a name at the Silverlight forums has found a solution that worked for me:
Just add or uncomment this entry to your hosts file (%SystemRoot%\system32\drivers\etc\hosts):
127.0.0.1 localhost
I noticed this as well with Silverlight 4, but also when I start a simple web project.
IE9 has a shorter startup time that IE8. Debugging a Silverlight application starts the development web server to host the http:// site. The time that it took to start up the web server was less than the time to start up IE8 and greater than the time it takes to start up IE9.
#Michael S. Scherotter - It can't be because of the shorter startup time because making the host file change which fixed it for me would have zero impact on app startup time. Something else must be causing the browser and Cassini to not talk to each other correctly.
One other fix, related to the others is to change the StartURL to launch to the loop back address directly, rather than editing the hosts file. So, in one app, I've got this as the start URL:
http://127.0.0.1.:60525/
Of course, to make this work consistently, I've selected a "specific port" in configuration, as 60525 in this case.
(the trailing . after the loop back address is to allow Fiddler to do its magic).