Undebuggable – who is killing my app?
Here is an interesting problem that I have no solution for so far.
class Program { static void Main(string[] args) { var foo = new Important(); try { AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) => { Console.WriteLine(eventArgs.ExceptionObject); }; using (var backend = new BackendBridge()) { backend.Start(23321); string filePath = @"E:\Samples\blob.nhprof"; using (var stream = File.OpenRead(filePath)) { backend.LoadFromFile(stream, new CancellationToken()); } } Console.WriteLine(foo); } catch (Exception e) { Console.WriteLine(e); } finally { Console.WriteLine("Done!"); } } private class Important : CriticalFinalizerObject { ~Important() { Console.WriteLine("finalized"); } } }
The problem is quite simple, reading the file will kill the application. The problem? I don’t know why.
The only output from the program is “finalized”, which suggest that there is something really nasty going on there. I am open for suggestions, because I have no idea how to deal with this thing, to tell you the truth.
Comments
So there isn't anything of importance in BackendBridge that could be causing the problem?
There is a LOT in there.
The problem is that I don't know what the problem is. And I get no exceptions
I guess this is perfect case to use Windbg.exe -- get the crash dump
blogs.msdn.com/.../...ace-and-what-is-sos-dll.aspx
My guess is that an exception is being thrown from the finalizer. If you take that thread down, you take down the entire Process. I blogged about a scenario like that with Oracle: blog.cornetdesign.com/.../exceptions-in-constru...
You could try connecting to it with WinDBG, doing a ".loadby sos mscorwks" then a "sxe clr" then a "g", then seeing what exceptions get thrown (by doing a "!printexception").
Or if you can send me a repro, I can take a look at what is going on. But that should spit out where you are dying.
So that is the symptom of an unhandled exception like you are trapping on the CurrentDomain. Is there some dynamic logic in that backend that creates its own AppDomain so that the deep issue truncates the application without warning?
Fred & the rest,
See the next post to get the details about that.
Is a hidden Ninja or Chuck Norris !
Comment preview