I have the follow code part
try
{
ThreadPool.BindHandle(_client.Client.Handle);
}
catch (ApplicationException)
{
}
Visual studio still stops in line ThreadPool.BindHandle(_client.Client.Handle); with message that ApplicationException was unhandled in code. Why unhandled when it is handled? Why does VS stops there? (VS 2015/2013/2015).
Related
So, I made a fresh ASP.NET Core Web App (Model-View-Controller) project in visual studio 2022 and .NET 6 like shown below.
When I start the project (without changing anything) I get the following 3 exceptions:
Exception thrown: 'System.IO.IOException' in System.Net.Security.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
However the project still runs and the website opens as expected.
Are these exceptions something to worry about?
The fact that an exception is thrown is not a problem. Exceptions get thrown. That's what they do. It's a problem when they aren't caught and managed appropriately. If your code isn't even seeing those exceptions then they are being caught and handled in system code, so they're not relevant to you. If your application crashes, that is an unhandled exception, so you need to look at why it's being thrown and whether or not you need to prevent it and/or catch it and clean up.
How to debug watches Visual Studio debugger is unable to show?
How to know, which exception occurred and how to fix it?
Expression watched is exactly the same as it was in code line earlier, so I suspect Visual Studio just unable to compute certain expressions in debugger.
I'm making a Roslyn diagnostic. When debugging the diagnostic, which launches a separate instance of Visual Studio, I get the following exception:
Exception thrown: 'System.InvalidOperationException' in
Microsoft.VsHub.Client.dll
Additional information: Could not locate the hub named 'Roslyn'
No further details are given. What does this exception mean? What can I do about it? I'm quite confused because earlier I was able to debug this project just fine. I've tried to 'git clean -f -x -d' but to no avail.
As discussed, Visual Studio throws a lot of exceptions during startup. Debugging tips are either:
Enable "Just My Code" under Debugging > General in Tools Options.
In the Exception Settings window, make sure breaking on an exception being thrown is off.
I create a new C# Windows Form project in Visual Studio 2013 Update 5. I do not change it in any way. It debugs properly as usual. As soon as I change the Platform target to x64, the debugger shows this error:
System.AccessViolationException was unhandled
Message: An unhandled exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
This happens in every 5 times of debugging. Do you have any idea on what may be causing this error and how it can be fixed?
I have a WCF project (.NET 4.5) and when I call a long running function on it, I'm getting this error:
A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll
in the output window, but the thing is when I debug the project, there are no exceptions thrown in the project and the project keeps running/debugging as if no error happened. I thought that if there was an exception in my code, it should break and show the stack trace, but in this case no errors and keeps running. I'm seeing this information like a lot. It fills the output window and keeps going/adding
Do anyone know what this error means? Why am I not getting unhandled exception thrown error if this is true?