When running my application, I found exception log below in Output panel of Visual Studio.
A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
This application's architect is as follows.
I want to know details of InvalidOperationException called from, but it's only shown on Output panel, so I can't catch it for viewing stack trace. Is there a way to know it?
InvalidOperationException is used in cases when the failure to invoke a method is caused by reasons other than invalid arguments. Typically, it is thrown when the state of an object cannot support the method call. For example, an InvalidOperationException exception is thrown by methods such as: IEnumerator.
Windows. Forms. dll is located in the folder C:\WINDOWS\Microsoft.NET\Framework\v2.
Add a new form In Visual Studio, find the Project Explorer pane. Right-click on the project and choose Add > Form (Windows Forms).
The best way to find where an exception like this is being triggered is to set the debugger to break on all exceptions.
You can do this by going to the Exception Settings window and checking the checkbox next to Common Language Runtime Exceptions under 'Break When Thrown'.
If you don't see the Exception Settings window, you can open it from the top menu at Debug -> Windows -> Exception Settings (there's also a keyboard shortcut of Ctrl+Alt+E to open it.
This will break anytime a .NET exception is thrown, regardless of where or whether it's handled.
This won't fix your problem, but it'll help identify it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With