5

VS 2010, VB.NET:

Seems I must have tampered with some settings. When I now get an exception it doesn't highlight the respective line in code.

2nd issue: Also if the exception is in a library file, I want this file to pop up and highlight the correct line.

The tab that pops up on exception now says "No Source Available".

So what settings control this behavior?

bretddog
  • 5,411
  • 11
  • 63
  • 111
  • Have you started the application via ["start debugging(F5)"](http://blogs.msdn.com/b/zainnab/archive/2010/11/01/start-debugging-vs-start-without-debugging-vstipdebug0037.aspx)? – Tim Schmelter Jun 30 '11 at 09:51
  • Yes I use correctly F5 or respective menu item. – bretddog Jun 30 '11 at 09:56
  • 1
    Have you looked [here](http://stackoverflow.com/questions/314329/getting-rid-of-there-is-no-source-code-available-for-the-current-location)? – Tim Schmelter Jun 30 '11 at 09:57
  • Thx, I tried those things, doesn't help. It's now all my projects behave this way, not just this one, so I assume it must be some setting. – bretddog Jun 30 '11 at 10:24
  • I have not tracked down the details, but this happens on my system when I have "Enable Application Framework" checked in the project properties. – xpda Aug 27 '11 at 18:53

5 Answers5

2

Menu > Debug > Exceptions

Seems "Common Language Runtime Exeptions" was unchecked, so I checked it. Not sure if this is the proper way to "treat" the issue, as now it halts on all type of exceptions, unless I uncheck them. But at least it helped me.

bretddog
  • 5,411
  • 11
  • 63
  • 111
1

this happened to me recently and worked out it was because I had unchecked enable just my code in

Tools > Options > Debugging > General > Enable Just My Code

PB1
  • 117
  • 4
0

Delete the PDB files from bin/debug and rebuild your application.

Hasan Fahim
  • 3,875
  • 1
  • 30
  • 51
  • @bretddog. To be able to highlight the line in the class library, where an exception occurred and also to debug the class library from main application, you need to include a project reference to the class library. If you have referenced the class library by browsing to it's bin and clicking on it's dll, you won't be able to debug it. Also after modifying the class library you need to update it's reference in the main application to reflect the changes. – Hasan Fahim Jun 30 '11 at 10:26
  • @Hasan Yes I'm currently referencing the library bin/debug/..dll "include a project reference to the class library", Do you mean I should add the class library project into my custom project solution, or may you describe more detail plz, as I don't see how to add a reference if not to a dll? – bretddog Jun 30 '11 at 10:48
  • @bretddog. To be able to step into the code present in the class library while debugging, you need to add the class library project to the solution and then add the reference to it like this: Add Reference -> Project -> Select name of class library -> Press Ok – Hasan Fahim Jun 30 '11 at 11:35
  • @Hasan. Thanks, then I understand how to solve that. Though this was only my secondary issue, as the highlighting is still not happening either in the project files or the library files. – bretddog Jun 30 '11 at 13:54
  • @bretddog let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/1014/discussion-between-hasan-fahim-and-bretddog) – Hasan Fahim Jun 30 '11 at 14:01
0

You could try by specifying the source code location for the library you want to debug in the Debug Source Files dialog:

Right-click on the Solution -> Properties -> Common Properties -> Debug Source Files

Enrico Campidoglio
  • 56,676
  • 12
  • 126
  • 154
  • But is this supposed to be required, or should it be included there by default when adding a reference? Currently there is no project specific directories specified there. – bretddog Jun 30 '11 at 10:20
  • @bretddog No, it's definitely not required in order to debug source code that isn't part of your solution. However it could be worth to try it out. I would also encourage you to check out [this Visual Studio gotcha](http://www.ademiller.com/blogs/tech/2007/12/gotchas-visual-studio-debugging-and-stepping-through-source) since it may relate to your situation. – Enrico Campidoglio Jun 30 '11 at 12:28
  • Thanks, that gotcha was not present. It's not just external files I don't get highlighted, also not the project files itself.. – bretddog Jun 30 '11 at 13:58
0

Probably you are developing a solution/project with a "any CPU" target and you have a 64 bit operating system. Try putting a try... catch statemente in the lines of code you are interested in

Andrea Antonangeli
  • 1,242
  • 1
  • 21
  • 32