Regarding ThreadExceptionDialog dialog - c#

I know that the ThreadExceptionDialog is thrown for all exceptions that occur in the program.
My problem is that the dialog form shows assembly information along with the Exception details.
Is there a way to hide the assembly information and show only the exception information?

You can "disable" this behavior completely by calling Application.SetUnhandledExceptionMode() in the Main() method of your application. As far as I know, there isn't a way to hide just the assembly information from the default ThreadExceptionDialog. However, if you set your application to handle ThreadException, you can display your own information. If you don't override it, you get the normal ThreadExceptionDialog and the user may quit or continue. Continuing is not a good outcome 99.99% of the time.
Please review the MSDN document for more information.

Related

WPF default behavior on exceptions

Please note that I'm aware of possible solution and have read some other SO posts which will answer the question how to handle unhandled exceptions globally and I'm not asking if it is good practice or not.
What I'm asking is:
Why do WPF applications close on exceptions?
I always thought that it is the expected behaviour, however when researching how to implement the exception handling globally in WPF, I encountered this sentence on the Microsoft documentation page:
By default, Windows Presentation Foundation catches unhandled exceptions, notifies users of the exception from a dialog box (from which they can report the exception), and automatically shuts down an application.
But my experience is different, the application just exits without any warning, so any unhandled exception will be a total mystery for the user and me as a developer.
My question is really: Am I missing something, or is Microsoft wrong about their own framework?
The docs seems to be wrong.
By default, a WPF application exits without any dialog box when an unhandled exception is thrown on the dispatcher thread.
You may consider to edit the docs and submit a PR on GitHub by clicking on the "Edit" button in the top right corner of the page.

Object already in use elsewhere

When I am drag picture Box in Windows form it's showing as Object already in use elsewhere.
I searched over Stack overflow and other website says that error is Threads, Coding oriented and GDI+. But I didn't write any coding in that. I just drag the picture box. Then it shows “already in use elsewhere”.
Anyone Explain?
This is usually an indicator that something else, potentially some other thread in your own application, already has the target file that you're trying to save locked at the file system level. If you look at the inner exception I believe it should mention this. If it's not directly in the InnerException Another way to confirm this (or discover what it might really be instead) is to turn on first chance exceptions in the debugger and watch for what exception is being thrown "underneath" Save and then being turned into this generic exception.
A Generic Error occured at GDI+ in asp.net mostly because of missing target folder / access permissions.

mono - the requested feature is not implemented - what feature?

I'm receiving this error when I start my application but I have NO idea what feature isn't implemented. It doesn't print anything to the console or tell me what isn't implemented.
Is there a way to figure this out? The only thing I have to go on is this error message that appears in a window:
Interestingly enough my application does start after I click ok, but I'd like to figure out what the problem is.
Minimize to systray is my first guess. That wasn't implemented last time I looked.
But you might be able to find a stack trace in Windows' Event Viewer -- Application Log

Using A Custom Exception Form

I'm currently working on a C# WinForm application, and am trying to create a custom Form to use whenever an uncaught exception is thrown. The reason for this custom form, is to be able to log the details of every thrown exception in a log file, as well as provide the user with a sharp looking GUI with better, and easy to understand details of the error that occurred.
As it stands right now, i am registering for exception events:
Application.ThreadException += new ThreadExceptionEventHandler(ExceptionHandler.OnThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler.OnUnhandledException);
The ExceptionHandler class logs the error in a log file, and then displays my custom WinForm. My question is, is this the only way to display my custom form? An issue i know of right now, is i am unable to determine whether the application can still continue, or if it will close when the form is closed.
Overall, my question is... Is there a better, or easier way to use my custom exception form? Also, is there a way to know IF the application will be able to recover, once the Exception form is closed?
It's not safe to continue running a program if you don't understand the reason for an exception.
This topic is discussed in more detail here:
http://blogs.msdn.com/b/codeanalysis/archive/2006/06/14/631923.aspx
You should start by exiting the application for any error you do not anticipate. The form is a nice touch but beware it may not work, since you do not know what the problem is - so wrap that in a try catch. Then as errors come up do some analysis and if it is something you can recover from than catch that specific exception and recover. Typically though if something bubbles all the way up to AppDomain.CurrentDomain.UnhandledException it is probably something that will leave the app in a bad place and you want to close.

DevExpress XtraSpellChecker randomly stops working, shows all words as mis-spelled

We recently released a desktop record keeping product that required a simple spell checker on a couple text box fields. We use DevExpress 10.1 XtraSpellChecker. It does exactly what we need but customers report that occasionally it simply stops working and shows all words as being mis-spelled.
My guess is that it cannot open the dictionary but I have no clue as to why. Typically stopping and restarting the program solves the problem.
Most instances of this error occur on computers with single users who have full modify rights on the installation folder ( location of dictionary ).
Anyone experience the same thing, have ideas of what might be causing this? Search of DevExpress forum has proven fruitless. It does happen on more than one installation but several have reported no issues.
Oh, and we are using it in Spell As You Type mode.
The check as you type mode works by checking the text in a background thread. Such a situation can occur if an exception is raised in the background thread that terminates it. Try to include a handler to all exceptions raised in your app and ask your users to send you the log when this problem occurs. To learn how to catch exceptions in all threads, please refer to the code snippet posted in the
Application.ThreadException Event MSDN article.

Categories