•   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

As I wrote some time ago, we were porting our application to .NET 6. One weird stuff that we were still compiling everything as a .NET Framework application but executing it in .NET 6 runtime.

Pretty much everything works just fine but some 3rd party assemblies do not work because they are using something that is absent in .NET 6. One such assembly was the System.Data.Odbc. And we didn’t reference it as a package and this assembly was simply present in our application directory.

Typically for these cases, I would download a package from nuget.org, open it as a zip archive, then go to the lib directory, find the appropriate version, and replace the version

Finally, CrowdStrike released a full report of what happened and you can find it here. There are quite a few interesting topics there. Firstly we will check what is interesting in this report.

1. “Rapid Response Content is delivered through Channel Files and interpreted by the sensor’s Content Interpreter, using a regular expression based engine”.  If this is a true regular-expression engine, then it is really bad. As you probably know, Windows drivers are typically written in C, and I would never put a C-based regular expression engine into the driver. It is just too risky.

There are multiple issues with regular expression libraries. Firstly, it is hard to prove that it is working correctly. Typically there are many

Recently I watched this video about Windows 8. Basically, the author claimed that this version of Windows almost killed Microsoft. I was professionally using Windows 8 and Windows 8.1 for many years and I can state that this is just somewhat a clickbait.

Yes, Microsoft made a mistake and there was too much focus on tablet mode. But it is easy to tell now when we know that tablet PC didn’t become a thing. But at that time conception of the tablet PC looked logical.

Plus idea of having the same Windows with the same UI everywhere was also quite appealing. You write your application once and you can run it on the phone, PC, and XBOX. And I’m