I'm having the following error when closing a form in an application
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
***** Exception Text *******
System.NullReferenceException: Object reference not set to an instance of an object.
at Infragistics.Win.UltraWinGrid.UltraCombo.get_Text()
at Infragistics.Win.UltraWinGrid.UltraCombo.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
I'm almost sure that this has something to do with the fact that I'm using multithreading to populate some data, but my problem is that I'm not able to determine the place in which the call to the method is being made.
A .Net framework appears and I can only click continue or close, but what I really wanted was an application crash to determine what is causing the error. This is even more complicated because it only happens with compiled code. Do you know any profiler or technic to catch the error?
Can I attach the debugger to my exe to capture the method throwing the error?
UPDATE:
What I really want is to enable JIT debugging and have access to the stacktrace tho determine the cause of the error, I've done that by adding the
<system.windows.forms jitDebugging="true" />
to the config file as described in MSDN to my config file, but now I'm not getting any error at all.
Bottom like, can I do anything else for the framework give additional details about the error?
You can set Visual Studio up to break on specific types of exceptions. There is an Exceptions dialog under the Debug menu. Just check the exception you wish to break on and run the code with the Visual Studio Debugger attached.
Related
I want the debugger to stop when:
A handled or unhandled exception occurs.
An unhandled exception occur in a function that has a DebuggerStepThrough or DebuggerHidden attibute. Debugger should stop where this function is being called.
There is no problem so far, I could able to make Visual Studio 2015 work like that. However when an handled exception occurs inside a function that has a DebuggerStepThrough or DebuggerHidden attibute, the debugger stops where this function is being called.
I couldn't find a way to fix this. I don't remember this behavior on Visual Studio 2010 or 2013. I've searched about it, and did not find anybody asking about the same issue.
Edit:
I have tried DebuggerNonUserCode, result is the same. It says "Exception thrown". No it does not!
My settings:
You could use the DebuggerNonUserCode Attribute instead of the DebuggerStepThrough or DebuggerHidden attribute in VS2015 since there are a few small differences between them:
https://blogs.msdn.microsoft.com/visualstudioalm/2016/02/12/using-the-debuggernonusercode-attribute-in-visual-studio-2015/
Update:
I get the same issue as yours using the VS2015. I found that it would be related to on debugging option, please enable the option "Use Managed Compatibility Mode" under TOOLS->Options->Debugging. Debug it again.
The MSDN article Using the DebuggerNonUserCode Attribute in Visual Studio 2015 explains what the DebuggerNonUserCode does and why it doesn't ignore exceptions.
This is caused by a performance improvement in VS 2015
when Just My Code is enabled, the debugger no longer gets notified of exceptions that are thrown and handled outside of “your code”.
This leads to a big performance improvement because:
The debugging performance improved because when Just My Code is enabled, the debugger no longer gets notified of exceptions that are thrown and handled outside of “your code”.
This behaviour can be switched off through a registry key introduced with Update 2:
To enable this, run the following command from your command line that will tweak the registry for you:
reg add HKCU\Software\Microsoft\VisualStudio\14.0_Config\Debugger\Engine /v AlwaysEnableExceptionCallbacksOutsideMyCode /t REG_DWORD /d 1
You'll have to experiment and see what is more important, ignoring exceptions or better debugger performance.
I am debugging a button in my C# code, and I get a JavaScript runtime error thrown on click from a script that I have never touched at a throwerror() line. My coworker, on the other hand, gets an error that points to the actual line in the C# code that is causing the problem. We can't seem to figure out how to get my copy of Visual Studio to throw the helpful non-JS errors.
When I debug (Clicking 'Start Debugging' with Internet Explorer selected), and I try to debug a asp.net button, I receive an error in ScriptResource.axd, like this:
And is shows me that the error is here:
Now, when my colleague does the same process to debug the same code, this is the error he receives:
We are both using IE to debug in Visual Studio. Both VS instances are 2012. I have not come across this issue and neither has my colleague. Does anyone have any insight to this?
Have you tried comparing Exceptions settings in "DEBUG->Exceptions..." with your coworker
The ScriptResource.axd actually does create runtime generated JavaScript.
Have you tried using the continue button? It might cause the follow up error to appear.
I am trying to debug Windows 8 C# Store application with Local Machine debugger. So, I added some incorrect line to MainPage constructor, after InitializeComponent call. I tried the code that causes DivideByZero or NullReferenceException - with the same results.
So, I execute "Start Debugging", and debugger breaks here:
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
Stack information is not available, it is impossible to detect where is an error (only first-chance exception message in the Output window gives a hint).
I tried to define DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION in the project preprocessor symbols. This time I got the following strange message: "A debugger is attached to YourProgram.exe but not configured to debug this unhandled exception".
Only when specific exception type is checked in the "Exceptions" dialog, and DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION is defined, I managed to break on the line which caused the error.
So, what is the right way to break on the offending line, like is was in traditional desktop applications debugging? If possible, without modifying Exceptions list. And what is exactly the purpose of DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION constant?
It looks like a xaml parsing exception. Have you be able to look at the exception message and see where the error is?
Here is some sample screenshot:
Well when you start Visual Studio you must click on debug and then Options and Settings and then General in Debugging and click on Enable Just My Code.
It can be helpful to enable "Common Language Runtime Exceptions" in "Debug/Windows/Exception Settings" before debugging.
Visual studio will now break on the actual error.
I have a dump file from an mvc4 web api that is pretty much crashing the w3wp.exe process (the bits are based off a debug build). I started diag debug diag to get the .dmp and there are parts of the .net stack .html summary for the crash report of the .dmp file that reference some of my methods which are probably suspect including a cacheing object as well as a db context that are somehow crashing due to systemobject dispose (something is going out of scope when I reference something..either cache or db context or both). It makes sense that those items are contained in the list summary of the .html .dmp report but they really don't tell me where the code is throwing.
With the .dmp file at hand when I try to load it within Visual Studio to Debug and link back to source code I get the following errors:
1) Debugging inforamtion for w3wp.exe cannot be found or does not match.
Symbols loaded (source information stripped). Do you want to continue
debugging?
continue selected...
2) Unhandled exception at 0x000007fefdc3cacd (KERNELBASE.dll) in
w3wp_MyApp_PID_36504_Date__02_14_2013__Time_04_32_57PM_276_First
chance exception 0XE0434352.dmp: 0xE0434352: 0xe0434352
I have the Debug/General "microsoft symbol servers" checked to presumably down any necessary symbols and linkage. However, when I continue and break after the last error, there are no references to my code within the call stack or the Debug/Windows/Paralell Stacks but I dont' see any of my classes or object called or spelled out. All is see are offsets and the disassembly with a carret as the break point at some "mov" operation.
I've followed this troubleshooting/debugging link to book but still cannot get any symbols to resolves to locals or see any of my method names being called.
http://blogs.msdn.com/b/tess/archive/2009/06/16/first-look-at-debugging-net-4-0-dumps-in-visual-studio-2010.aspx
ASK: How can I link this .dmp to the exact line of code that is throwing? Thanks!
Load it in windbg.
Load sos (in .NET 4 .loadby sos clr or in previous versions .loadby sos mscorwks)
!Threads
At this point you should see an exception in the relevant thread. If not, you might need to go searching for it using !DumpHeap -type Exception or something similar.
Use !pe <address> to examine the exception.
I'm happy to help if you get lost. Windbg is not easy.
while i am calling a method which is declared in another project. calling project and called project are presented in same solution.
I am getting a error window that says:
Window Tile : Test.vshost.exe
Test.vshost.exe has encountered a problem and needs to close. we are sorry for the inconvenience.
(I will make disappear the error window by clicking "Dont Send" button)
what is the reason for such this error.
Note: I have included the refereed project in reference.
I used call a methode as follows
ReconcileDBService.InsertRecordInT_AUDIT_Incident(keyCase);
Above methode declared as follows
public static void InsertRecordInT_AUDIT_Incident(string keyCase)
We can't really help you based on the data you provide...
Is your program using Win32 or COM interop ?
Try to add breakpoints and debug messages to pinpoint the problem. Once you know the exact location where the problem occurs, it will be easier to understand it.
Turn off the "Visual Studio hosting process" and start your session again. Maybe you get some better or more information about an exception that is raised by your programm.
You can do this under the Project-Properties-->Debug-->Enable the Visual Studio hosting process (uncheck)
Also you could check the build order of your projects. It may be that the "Visual Studio hosting process" uses a diffrent assembly version than your programm expects.
Press Ctrl-Alt-E (Debug->Exceptions) and in the 'Break when an exception is:' selection, select everything.
Start a debug session with the application.
The debugger should now stop at the crash and you should be able to look what you are sending to the other project, and maybe solve your problem.