•   Posted in:
  • .NET

Our application is written in 3 languages and very often it is hard to get a full call stack. We are constantly improving it but, in some cases, it is really hard to find the source of the problem.

Very often I had to investigate crash dump without any visible .NET stack in it. Usually in this case, I want to see if there are any .NET exceptions and their call stack. For this, I use the following command in WinDbg:

!DumpHeap -type Exception

Typically it will print any object that has the word “Exception” in their name. Something like this:

7ffcbebbc7f8     1        80 System.Collections.Generic.Dictionary<NLog.Config…
7ffcbfeeed68     2        80 System.Lazy<System.Collections.Generic.IEqualityComparer<System.Exception>>
7ffcbeb71088     1       112 NLog.LayoutRenderers.ExceptionLayoutRenderer
7ffcb918f328     1       128 System.OutOfMemoryException
7ffcb918f428     1       128 System.StackOverflowException
7ffcb918f528     1       128 System.ExecutionEngineException
7ffcb92be9c0     4       256 System.Windows.Threading.DispatcherUnhandledExceptionEventHandler

  •   Posted in:
  • .NET

A few weeks after we converted our application to .NET I received an email that states that there are a lot of network exceptions thrown by our application during normal work. None of them are visible to the customer and it just a lot of exceptions.

Obviously, I started my investigation and after some time I found a way to reproduce them. All I needed was to enable all Exceptions in Visual Studio and tell our application to establish a network connection to any server. And after some execution stopped with System.IO.IOException and message: “Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..”

  •   Posted in:
  • .NET

I was porting our application to .NET 8 and I found that some 3rd party library throwing InvalidProgramException with the message “Common Language Runtime detected an invalid program”. It is not something that you see often and I started investigating.

The code looks like this:

…
ilgenerator.Emit(OpCodes.Brtrue_S, (sbyte)(OpCodes.Newobj.Size + 4 + OpCodes.Throw.Size));
ilgenerator.ThrowException(typeof(ArgumentOutOfRangeException));
…

That 3rd party library trying to generate IL code that checks a boolean condition and if it is false then throw an exception and otherwise skip that block and continue execution. I reviewed the code it tries to generate and I didn’t find anything suspicious.

At that moment, I had an assumption that the IL code was not valid and newer version