标签云

微信群

扫码加入我们

WeChat QR Code

C# desktop application on express edition. Worked then didn't work 5 seconds later.I tried the following.Ensure debug configuration, debug flag, and full debug info are set on all assemblies.Delete all bin and obj folders and all DLLs related to the project from my entire machine.Recreate projects causing the problem from scratch.Reboot.I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?I want to add in here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed. If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.


When debugging, goto to the Debug, Windows, Modules view. This will show info about loaded modules and symbol status. You can right click a module and try to load the symbols from another location.

2019年10月20日44分48秒

Express edition does not have Modules view.

2019年10月20日44分48秒

Good point about assemblies not loaded until needed.The debugger will show that the breakpoint won't be hit, but the display will change/your breakpoint WILL be hit once the assembly is loaded.A cheesy workaround this UI issue would be to make a call to the assembly at program start to force the assembly to be loaded.

2019年10月20日44分48秒

I had same issue and I noticed that for this build configuration I didn't have <DebugSymbols>true</DebugSymbols> under it in VS2015 I manually added it and it worked fine.

2019年10月20日44分48秒

Removing the .suo file might have solved this ugly problem at my project

2019年10月20日44分48秒

Effectively, that was the issue on my case. We had a postcompile that made it to not be considered 'User Code' ... now, I have to see what's up with that, but I do confirmed that without the postcompile modifications, the symbols are loaded. Hans thank you, saved me some good minutes! sends a virtual beer

2019年10月20日44分48秒

The question is about express edition, to which this answer does not apply, unfortunately. Actually none of the answers work for me, I also tried removing the Debug folder and rebuilding.

2019年10月20日44分48秒

Microsoft Visual Studio Express 2013 for Web does not have Debug Windows Modules option. Howo to use fix this in this case ?

2019年10月20日44分48秒

As a hint, turn on your exceptions so it breaks where you want it to (if you are unable to put a break-point in the beginning of the process)... You then follow Han's recommended process of Debug > Windows > Modules. Look for the project you were trying to step into and look at the PATH. if it says "C:\windows\assembly" then its pointing to a GAC dll and NOT the project...

2019年10月20日44分48秒

i had my solution's active solution configuration set to Release , changing it back to Debug solve my problem. This answer helped me "remember" what to look for

2019年10月20日44分48秒

Make sure that [Debug Info:] is set to [full] - fixed it for me! I have multiple configurations set up on my project, the new ones I added didn't have this set.

2019年10月20日44分48秒

Turns out I was in the release build. tsk.

2019年10月20日44分48秒

If you don't have a build tab, you can also go compile > Advanced compile options> steps 4 - 7. That did it for me.

2019年10月21日44分48秒

If you have a mixed C++/C# project with a native startup, make sure it's project's Debugging > Debugger Type is Mixed.

2019年10月21日44分48秒

I also had to make sure that Properties > Build > Optimize code was unchecked.

2019年10月20日44分48秒

How did you fix the breakpoints with multiple projects in a solution - some compiled as x86, some as x64?

2019年10月20日44分48秒

If you are running IISExpress (or the Azure emulator), the files in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root may not get updated if your AssemblyVersion is 1.0.0.0.Make sure there it is something like 1.0.* so that a new version is generated each time you build your web project.Clean Solution does not clear out the temporary internet files folder.

2019年10月21日44分48秒

My vs 2015 has no "clean solution" command.

2019年10月21日44分48秒

This does the same thing as doing a Rebuild All.

2019年10月20日44分48秒

jonathan Wood - I'd mostly agree with that. But in rare circumstances, Rebuild All can produce slightly different results - I know I've seen strange differences at times. Havea look here for some interesting discussion: stackoverflow.com/questions/1247457/…

2019年10月20日44分48秒

Yep, on a Windows Phone 8 project with a custom build configuration, this is what did it for me.

2019年10月20日44分48秒

Worked for me with Windows Phone 8.1 and VS Community 2015.

2019年10月20日44分48秒

Just to be clear: In VS 2017, this setting is specifically in the Tool, Options dialog under the Debugging, General pane (there is no "Debug" pane, to be accurate). The checkbox is called "Enable Just My Code" not "Just My Code".

2019年10月20日44分48秒

This is working for me however I can't see the variable value when hover or shift+f9 getting an error Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away

2019年10月20日44分48秒

Still working in Visual Studio 2019!

2019年10月20日44分48秒

This also handles situations where you are trying to debug a WEB project that is a .NET remoting endpoint running on the VS development server and showing "no symbols loaded".

2019年10月20日44分48秒

This fixed it for me. I think previously sombody had tried to attach the debugging to the local IIS server instead of the debug version of IIS that visual studio uses.

2019年10月20日44分48秒

If you have removed the .suo file you can lose the solution settings selected here and will have to set them again

2019年10月21日44分48秒

I checked these settings again today after previously debugging successfully and found that my startup projects had somehow reverted to a single start up project. It is worth double checking.

2019年10月20日44分48秒

I was running in release mode. Thanks !!

2019年10月20日44分48秒

Key for me was that the 'Deploy' box wasn't checked, thus the pdb wasn't being re-deployed after building

2019年10月20日44分48秒

For others who have tried everything on this page, I fixed my issue by switching to 'Managed (v4.5, v4.0) code'!

2019年10月20日44分48秒

Switching to "Managed (v4.5, v4.0)" fixed it for me as well with debugging a DNN ASP.Net app.Thanks!

2019年10月20日44分48秒

Not work for me. The option was selected before

2019年10月20日44分48秒

I switched to Native and it sooo worked!!! Thank you!

2019年10月21日44分48秒

Switching from "Automatically determine the type of code to debug" to "Managed (v4.6, v4.5, v4.0)" worked for me. I have a solution with 2 class libraries, one is COM accessible, both are targeting framework 4.6.1.

2019年10月20日44分48秒

This was my problem, the folder must have been full of broken DLL's which were being loaded as a preference.

2019年10月20日44分48秒

This worked for me, except in my case, the directory I had to purge was C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\vs\

2019年10月20日44分48秒

I had a similar issue where I already had this application installed and it was loading that DLL instead of the one from my project with no associated PDB file. After uninstalling the old app, the issue was resolved for me. Thanks!

2019年10月20日44分48秒

This also works with full IIS.

2019年10月20日44分48秒

I would suggest anyone coming to this page to make sure the pdb is being generated as this was the problem for me.

2019年10月20日44分48秒

Thanks! "pdb-only" (rather than full) was enough. Also, "Advanced" is a Button at the bottom of Build.

2019年10月20日44分48秒

solved my issue in a .net core project

2019年10月21日44分48秒

Thanks, this fixed it for me after I made new Web.config transforms and deleted the default configs (like Web.Debug.config) that VS 2017 provides.

2019年10月20日44分48秒

Tried lots of other options (wasted almost 2 hours) This "full" option fix my issue. Thanks!

2019年10月20日44分48秒

This should actually be upvoted somewhere to the top. I spent lots of time doing all the answers above, but the breakpoint would actually be hit. Just check:) Also, that was a WPF desktop app.

2019年10月20日44分48秒

aspx seems to be compiled on demand, thus debuging info is available only after the aspx page is needed

2019年10月21日44分48秒

Also for UnitTesting - you need to wait a few seconds and then it gets hit.

2019年10月20日44分48秒

I think aeroson comment is what I ran into. One page loaded breakpoints, another didn't. Tried all kinds of things from answers here, and then refreshed that page, and the breakpoints loaded.

2019年10月20日44分48秒

thanks... digging around for half an hour and just realized that the breakpoint still gets hit...

2019年10月20日44分48秒

This was my problem too, and I went through all the above solutions one-by-one, nothing worked.

2019年10月20日44分48秒

I unchecked this option, clean solution, rebuilt solution, etc... VS was always considering the module as "Optimzed". The only way i found to force VS to update the debugging info was to increase assembly version of the module.

2019年10月20日44分48秒

The only solution that works for me, a # for you (# = ++++), but I can only vote one time

2019年10月20日44分48秒

it took almost 4 hours to find out this issue. thanks

2019年10月20日44分48秒

redundant to answer stackoverflow.com/a/21952302/3195477

2019年10月21日44分48秒

I ended up needed to run msvsmon as Admin on the remote machine.

2019年10月20日44分48秒

This is not a solution people should follow. If this fixes the problem then you should be focusing on why you would need admin rights in order for VS to be able to read your project's .pdb file contents.

2019年10月20日44分48秒

Jazimov I disagree. Whereas I'd love to spend time investigating this, in my case this solved my problem and allowed me to continue working as I'm sure it did for others too. If you'd like to look into it and improve this answer feel free, that's what it's there for.

2019年10月20日44分48秒

To be clear: I understand it fixed your issue with Visual Studio, that's not what I was disputing. I am disputing the recommendation that others accept running the IDE as the solution rather than simple a solution. If running the IDE as administrator fixes the issue then that information should be used to troubleshoot the actual root cause so that the IDE doesn't require admin privileges in order to work properly.

2019年10月20日44分48秒

Where should that be?

2019年10月20日44分48秒

Its the same as juFo's answer - Project > Properties > Build > Advanced > Debug Info > Full (or pdb-only)

2019年10月20日44分48秒

Listen to Jeremy Thompsen. It fixed the problem for me.

2019年10月20日44分48秒

Thank you zs2020

2019年10月20日44分48秒

make a deliberate change worked for me

2019年10月20日44分48秒

redundant to answer stackoverflow.com/a/21952302/3195477

2019年10月21日44分48秒

i did pdb_only, also clean and restart browser

2019年10月20日44分48秒

worked for me! great

2019年10月20日44分48秒

Worked for me in Microsoft Visual Studio 2013 under: File > Close Solution Then File > Open Solution (should be preloaded with the same folder it was in). Breakpoints went from yellow flag to circular red instantly. So thanks.

2019年10月20日44分48秒

Does not always work and did not work in VS 2015.

2019年10月20日44分48秒

Can I upvote 10K times? The worst of it all is that I think I've searched for this on google like 10 times now, and everytime is the same stupid mistake. Perhaps Microsoft could hint it to the user?

2019年10月20日44分48秒

redundant to answer stackoverflow.com/a/21952302/3195477

2019年10月21日44分48秒