Questions related to debugging methods and tricks in VisualStudio
Questions tagged [visual-studio-debugging]
2287 questions
35
votes
4 answers
Null reference pointer was passed to the stub when not debugging with IE
In VS2012, my web project debugs fine like always. I use IIS Express. Today, I installed VS 2013 and when I press F5 to debug, I get
I can't find a solution to this anywhere. I tried clearing out temp files, change the port number from 7227 to…

ScottG
- 10,711
- 25
- 82
- 111
33
votes
1 answer
"Initialize interactive with Project" is missing for .Net Core Projects in Visual Studio 2019
In VS 2019 the option to initialize projects on the C# Interactive console is missing when targeting .NET Core.
The option is also missing in VS 2017 and there is a related question for VS 2017. However the answer to this question mainly confirms…

Postlagerkarte
- 6,600
- 5
- 33
- 52
33
votes
6 answers
How to get non-current thread's stacktrace?
It is possible to get stacktrace using System.Diagnostics.StackTrace, but thread has to be suspended. Suspend and Resume function are obsolete, so I expect that better way exists.

bh213
- 6,343
- 9
- 43
- 52
33
votes
2 answers
Enable the javascript debugger in the Page Inspector
Visual Studio 2012 comes with the very nice Page Inspector. I like it! Problem though, I haven't found how (if?) I can turn on JavaScript debugging. Could someone point me in the right direction?

Martijn
- 11,964
- 12
- 50
- 96
32
votes
13 answers
Visual Studio loses ability to attach to Unity, why?
I'm using Visual Studio with Unity. In general in VS I can simply click "Attach to Unity" and it will build the solution and indeed attach to Unity.
Sometimes, however, a project loses the "ability" to do so, what means that suddenly clicking the…

Benjamin Zach
- 1,452
- 2
- 18
- 38
32
votes
4 answers
How to prevent Visual Studio from launching WcfSvcHost.exe while debugging?
I have a solution in Visual Studio 2008 which has multiple projects. One of the projects is a WCF project. Sometimes I just want to debug other projects, but when I press F5, Visual Studio has wcfsvchost.exe launched to host the WCF project even it…

Morgan Cheng
- 73,950
- 66
- 171
- 230
32
votes
2 answers
Force break on any exception thrown in program
When coding in C# I like not to handle exceptions because it makes it easier to figure out where and why things went wrong. However, I can't give anyone a program that doesn't handle exceptions.
Can I somehow force Visual Studio to break on every…

hsprogrammer
- 325
- 1
- 3
- 4
31
votes
8 answers
C# VS2010 Entering break mode failed
I was having some problems with my breakpoints later in my program saying that they would not be hit because the source code and the compiled code was different. I decided to put a break point on my public MainWindow() function, and see what…

Reid
- 4,376
- 11
- 43
- 75
31
votes
5 answers
No Source available
I am not sure what happened or if I did anything..
Now anytime I try and debug it says no source available on all BCL stuff
For example, on a debug.print I get that message with
Locating source for
…

Eric
- 3,027
- 6
- 29
- 34
30
votes
0 answers
How to debug Fable using Visual Studio (not Code)
I know it is possible to debug Fable apps in VS Code and hit breakpoints, but I haven't seen any examples of such when using Visual Studio. How can one debug Fable apps using Visual Studio, being able to hit breakpoints, inspect variables, etc.?

cmeeren
- 3,890
- 2
- 20
- 50
30
votes
9 answers
Can't break in global.asax / Application_Start
I got a break point on the first line of Application_Start(), but Visual Studio wont break on it.
Visual Studio have attached itself to the IIS working process:
Auto-attach to process '[2092] w3wp.exe' on machine 'SRD00510' succeeded.
My…

jgauffin
- 99,844
- 45
- 235
- 372
29
votes
3 answers
VS2022 - Can't view values of variables when exception thrown - Local variables and arguments are not available in '[Exception]' call stack frames
I'm getting an InvalidOperationException thrown (which should be easy to fix). However when the exception is thrown, I can't view any of the current values in the Locals debug window. They all have the same message:
Local variables and arguments are…

Calanus
- 25,619
- 25
- 85
- 120
29
votes
4 answers
Vector 'no operator "[]" matches these operands' error in Visual Studio watch
When stepping through the following sample code in Visual Studio 2012:
std::vector test;
test.resize(1);
test[0] = 4;
I can set a watch on test and inspect its 0th element. However, if I set a watch on test[0], I get the error 'no operator…

1''
- 26,823
- 32
- 143
- 200
29
votes
11 answers
Debugging MVC application in VS2012 attempts to start IIS Express twice
UPDATE
I'm certain this is a Visual Studio bug with no obvious solution. I've encountered a number of people who have the same exact issue. I have submitted a bug ticket with Microsoft…

w.brian
- 16,296
- 14
- 69
- 118
28
votes
2 answers
How to step into C/C++ DLL from C# application while debugging
I have two project in my solution: C/C++ Win32 DLL and some C# application.
What I have to do to be able to step into DLL while debugging?
I switched on all debugging options in C++ project's settings and copied to C# application root next files:…

abatishchev
- 98,240
- 88
- 296
- 433