Debugger was found - this software cannot be executed under the Debugger - c#

I am trying to debug a program I created in Visual Studio when I receive the error:
System.TypeInitializationException HResult=0x80131534 Message=The
type initializer for '' threw an exception.
Source=MaterialFileManagerSQLNet StackTrace: at
MaterialFileManagerSQLNet.frmMaterialManager.getAPILookupMaterial() in
D:\Ctes
Utilities\MaterialFileManagerSQLNet\MaterialFileManagerSQLNet\frmMaterialManager.cs:line
397 at
MaterialFileManagerSQLNet.frmMaterialManager.populateDatagrid(String
item) in D:\Ctes
Utilities\MaterialFileManagerSQLNet\MaterialFileManagerSQLNet\frmMaterialManager.cs:line
347 at MaterialFileManagerSQLNet.frmMaterialManager..ctor() in
D:\Ctes
Utilities\MaterialFileManagerSQLNet\MaterialFileManagerSQLNet\frmMaterialManager.cs:line
39 at MaterialFileManagerSQLNet.Program.Main() in D:\Ctes
Utilities\MaterialFileManagerSQLNet\MaterialFileManagerSQLNet\Program.cs:line
17
This exception was originally thrown at this call stack:
A.SBO.RG()
.()
Inner Exception 1: Exception: Debugger was found - this software
cannot be executed under the Debugger.
This is a C# WinForms program. It is adding and updating data to a sql server database hosted in a cloud.
it breaks here:
lsLookupMaterial = getAPILookupMaterial();
and resolves here:
private List<LookupMaterial> getAPILookupMaterial()
{
mGlobalSettings.saveSettings();
List<LookupMaterial> lsLookupMaterial = new List<LookupMaterial>();
if (mGlobalSettings.Server == E_Server.Local)....
I cannot even step into the function without the error occurring.
Has anyone encountered this? This feels like a project setting somewhere but I am unsure. I am already running under admin.

Turns out we have our own obfuscated code I was trying to step through. Got the latest signed code and all was well.

Related

Visual Studio Publishing throws System.AggregateException without details at main development-System

Visual Studio Error at Publishing
Hello,
this is my first Question on this board, but i got plenty of good answers from here recently so i hope somebody could help with this specific problem:
I want to realize .net core Applications running on a Raspberry pi 4 and everything works pretty fine except that my Visual Studio throws a strange Error everytime i try to Publish the dotnetcoreapp3.1 as Self-contained linux-arm.
The Error says further there would be more information in the output log-file, but i checked it and it just said the same undetermined Error:
22.04.2020 22:44:33
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---
System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
===================
I tried to publish the project at another device with Visual Studio and it worked fine, after that i deinstalled visual studio and reinstalled it, after this not working i tried to repair with still no effect.
I hope somebody has an Idea how i can fix this ^^
Sincerely yours
Solved it by deleting an old unavailable nuget-path

DotNetBrowser unhandled exception during execution

I've developed a multithreading WPF application which is using one instance of DotNet component (namespace WPF.DotNetBrowser).
The application was running during about 21 hours of nonstop work, and then it crashed.
An undandled exeption was raised in .dll library (which was added using the docs). Visual Studio Warning (which usually describes raised exceptions) shows:
An unhandled exception of type 'lld.reworBteNtoD ni derrucco'
And further description was:
Additional information: Failed to send message GetDeviceScaleFactorMessage {type=GetDeviceScaleFactor, uid=3719442, deviceScaleFactor=0}.
Finally the application went to break mode and the 'output' tab contained the following
An undandled exception of type '' occured in DotNetBrowser.dll
So it couldn't even determine the type of exception that had been raised. I think it happens because the exception was raised in the dll file.
How can I work around this? VS was running under admin rights and the application can crash unexpectedly at any time of it's execution.

Just-in-time debugger throwing errors during compile

I'm using VS 2008. I have a C# application.
When I try to build/run the project it opens the JUST IN TIME debugger for some reason disabling me from stepping through my code where the exception occurred.
How can I get rid of this JUST IN TIME prompt?
I did go to tools=>options-->debugging and disabled JUST IN TIME and now it is giving me an error message:
an unhandled win32 exception occurred in projectname. just in time debugging this exception failed with the following error...basically i guess it's trying to open just in time
How do I get normal compiler debugging capabilities?
Check out the following MSDN article: Just-In-Time Debugging. It sounds like in your case, you might want to make sure you have registry keys for JIT deleted.
Also, the following seems to be applicable in your case:
An unhandled win32 exception occurred in . Just-In-Time
debugging this exception failed with the following error: The logged
in user did not have access to debug the crashing application.
This message indicates that Just-In-Time debugging failed because you
do not have proper access permissions. For information on the required
permissions, see [Obsolete] Remote Debugging Permissions.

Visual C# Debugger not working

Something is seriously wrong with my VS Debugger. I run my application and do a specific task and it produces an exception 'A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll', thats all well and good but it just crashes my app when I expect the debugger to kick in and show me where the exception occurred. The project is set to Debug and the debugger is attached. So why is it not working as it should?
Try to enable Exception handling in Visual Studio, it should help to you yo stop on exact possible row where source code and debug data (PDB) are available.

Debugging .dmp files from WinDbg in Visual Studio 2008 for .Net managed apps

I am trying to find how to take a crash dump of a .Net managed executable and then open the resulting .dmp file in Visual Studio 2008. I want to see where in the source code the exception is thrown, the call stack and the value of variables in functions on the stack.
To simplify the problem, I've written a mini-app that crashes:
...
class Program
{
static void Main(string[] args)
{
int a = 2; //Variable I want to see value for when debugging
if (!File.Exists(#"C:\Crasher\bin\Debug\file.txt")) //Doesn't exist
throw new FileNotFoundException(); //Unhandled exception thrown
}
}
...
I did a DEBUG build and ran it from outside Visual Studio. In windbg, I clicked "Attach to Process" and selected my app. Then I typed in the windbg command window:
.dump /ma C:\crasher\bin\debug\dump.dmp
Then I opened the .dmp file in Visual Studio. I went to Tools->Options->Debugging->Symbols and added the following:
http://msdl.microsoft.com/download/symbols (saved to local folder)
This gives me symbols for all of the DLLs listed in the Modules window (e.g. Kernel32.dll, gdi32.dll - I think all of them listed are native) with the exception of mscorlib.ni.dll. The Microsoft Symbol Server gives me symbols builds and .pdbs for mscorlib.dll but NOT mscorlib.ni.dll.
When I try to load the .pdb for my .exe itself, it tells me it does not match the app. I think this is because the .exe is managed and we don't yet have symbols for all of the native code beneath it - i.e. if I could get a symbols build and pdb for mscorlib.ni.dll this would work.
Is this reasoning correct? Am I missing something else?
Either way, why is mscorlib.ni.dll not available on the Microsoft Symbol Server, where can I get symbol information and is there anything else I should know for debugging managed code through crash dumps in Visual Studio.
Many thanks - any help will be appreciated.
Phil Whittington
As Jason Evans says in his comment, this is not supported in VS2008, but you can do it in WinDbg.
The easiest way to get a correct dump for a crash like this is to use adplus (which is included in Debugging Tools for Windows). There are various options, but to get a crash dump based on the process name, you could do
>adplus -crash -o c:\dumpdirectory -pn app.exe
This will give you two dumps. One for the first chance exception and one for the second. In this case they will be virtually identical, but for a more realistic scenario the first chance exception dump will show you the state of the application when the exception was thrown (i.e. before any exception handling occur). The second chance exception dump will show you the state of the unhandled exception.
To get the exception, open the crash dump and load SOS by typing .loadby sos mscorwks.
Then use the !pe command to print the exception on the current thread (which will be the faulting thread in this case). It will look something like this:
0:000> !pe
Exception object: 024a5114
Exception type: System.IO.FileNotFoundException
Message: Unable to find the specified file.
InnerException: <none>
StackTrace (generated):
SP IP Function
0020F0F0 005100D6 TestBench!TestBench.Program.Main()+0x66
StackTraceString: <none>
HResult: 80070002
To list the local variable a use !clrstack -l, but keep in mind that locals are rarely available in a release mode builds due to optimizations.
0:000> !clrstack -l
OS Thread Id: 0x1a50 (0)
ESP EIP
0020f04c 7571b727 [HelperMethodFrame: 0020f04c]
0020f0f0 005100d6 TestBench.Program.Main()
LOCALS:
0x0020f0fc = 0x00000002 <--- the value of a
0x0020f0f8 = 0x00000000
0020f328 51141b5c [GCFrame: 0020f328]

Categories

Resources