Mysterious error dialog on exit...
-
I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!
-
I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!
-
Does the error dialog look like a one from the framework, the COM objects or a custom one or none at all? You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
It looks like a runtime error dialog.
-
It looks like a runtime error dialog.
Can you provide a bit more background as to what the application does, e.g. what are the COM objects but more importantly what is being done when your application shuts down.
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
-
Can you provide a bit more background as to what the application does, e.g. what are the COM objects but more importantly what is being done when your application shuts down.
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
I think I free all(!) the COM object using Marshal.ReleaseComObject. COM object do different things - one goes across winsock to a server the other loads msscript ctrl to execute some vbscripts. What's strange is that I have try-catch-finally in my main function of program around all those three lines including application.run, bug now debugger (debugging release) reports an thet there's an exception InvalidComObjectException beeing raised after! that try-catch-ficnally block - so after everything is run.
-
I think I free all(!) the COM object using Marshal.ReleaseComObject. COM object do different things - one goes across winsock to a server the other loads msscript ctrl to execute some vbscripts. What's strange is that I have try-catch-finally in my main function of program around all those three lines including application.run, bug now debugger (debugging release) reports an thet there's an exception InvalidComObjectException beeing raised after! that try-catch-ficnally block - so after everything is run.
So you've basically got:
static void Main(string[] args)
{
try
{
Application.Run(new MainForm());
Marshal.ReleaseComObject(msscript);
Marshal.ReleaseComObject(winsock);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}Am I right? (One thing I just thought of, do you dispose the msscript or winsock first because if the msscript control is disposed of second then it might be trying to access the winsock control (if you allow this interaction)).
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed