In the previous part, I explained certain issues in Example 2 for all types of cases: multithreading issues, and issues with recursive calls. Also must state that there is also a cost involved in calling the WriteProcessMemory function twice each call to the XYZ function. If the XYZ function is called often then we will have a performance hit. But is there anything we can improve? And it turns out that we can for Case 1.

Example 3 for Case 1

The main idea for this case is to call the WriteProcessMemory function only once. And when we need to call the original function we need to simulate instructions that were overwritten with jump instruction


There are times when you want to change the behavior of a function that you cannot recompile for some reason. For example, there could be a bug in a runtime function of your language. Changing the version of your language is typically quite a challenge and it could be much better to patch that function instead of making drastic changes like switching to a different version.

Or as another example, there could be some 3rd party library that has a bug and the author didn’t provide a source code. Or perhaps you want to do some pre or post-processing. For example, you may want to save some input or output parameters or even modify them.

For further discussion let's

Disclaimer: I have no financial or any other interest in this or any other products mentioned in this review. I review this product because I really like it.

Typically at home, I use relatively cheap headphones to listen to music, play computer games, and discuss stuff over Zoom or any other applications. Typically I buy something in the range of $25-$35.

Last several years I have been buying Koss multimedia headphones (SB45 or SB49). They cost around $32 and to the most degree, they were fine. But they have a few issues that eventually start to annoy me.

The most common issue is that, after some time fake leather starts to peel from head cups and stick to the skin

People don’t need electric vehicles anymore and the EV revolution is over. People don’t want EVs, they want hybrids. This is exactly the statement that mass media are trying to push to consumers.

But this is quite far from the truth. People still want EVs, but unfortunately, while demand is strong, the proposition is quite weak for each market segment except the most expensive one. And even in expensive segment proposition is quite bad.

But before I explain why, I must state that in most cases you want to buy an EV only in case you have a house or any other reliable place to charge it. Otherwise, it will be an unnecessary pain for your money.

If you try

I was never a fan of Intel for quite a simple reason – buying Intel chips was not optimal from my point of view. Other companies provided a better performance-to-price ratio. But I understand that nobody can tell any company how much money they should ask for their products and it is strictly up to them. If Intel wants to sell their processors for a lot of money it is their business. But in general, they were making good and solid products.

But everything changed from the release of Pentium 4. At that time Intel figured out that everybody was buying megahertz they decided to create a CPU with a lot of megahertz. And then Pentium 4 was born.


JavaScript is one of the languages that wasn’t designed properly. In fact, it wasn’t designed at all. It was an afterthought that just slapped into the browser to have some kind of programming. And because Java was a hot subject at that time, it got Java in its name. It has absolutely no relation to Java, except for some syntax similarity and garbage collection.

There were a lot of attempts to make it better and it has become better but it still has all the fundamental issues that almost all script languages have – lack of type system and that makes it unusable to write anything big or complex.

In a language with the type system compiler knows the type

  •   Posted in:
  • .NET

The previous part is here.

And finally, we are in the most important part which explains what works differently between the .NET Framework and .NET 6. Just in case I will talk about behavioral changes and about obvious parts like some methods that do not exist in .NET 6 but I will

  1. The .NET Framework will suppress all exceptions when it releases a reference to a COM object but .NET 6 will crash. One example of such a problem is when some object is freed despite having a reference count of more than zero. It is a bug and needs to be fixed. I just was surprised by how often it happened in our application.
  2. Accessing .NET from DllMain will lead to deadlocks. We had these in the .NET Framework, but they happened much more often in the .NET 6. And obviously, it needs to be fixed. It will take some time because it works most of the time and deadlock happens quite seldom.
  3. string.GetHashCode will return different values every time you start the application. Basically during startup runtime will generate a random seed and add it to the hash code. If you want hash code to persist then write a function that hashes string differently.
  4. When the application converts a floating point number to a string, the result will be slightly different. Here blog post that explains the changes. For example, when the .NET Framework outputs 3.1415, .NET may output as 3.141500001 or 3.141499999.
  5. Encoding.Default will be always UTF8 in .NET 6. If you want to return old behavior then you need to create Encoding from the current Windows code page.
  6. System.Diagnostics.ProcessStartInfo.UseShellExecute is true for .NET Framework but false for .NET As a result, previously it was possible to open the http link without changing properties but now UseShellExecute must be set specifically to true.
  7. Previously it was possible to bind to read-only property in WPF. Now it throws an exception and you need to add “, Mode=OneWay”.
  8. SHA512.Create("System.Security.Cryptography.SHA512CryptoServiceProvider") will return null. We replaced it with new SHA512CryptoServiceProvider().
  9. There is no SHA512Cng class. We replaced it with SHA512CryptoServiceProvider class that uses SHA512Cng internally when the application is running for Windows.
  10. Setting SecurityProtocolType.Ssl3 will throw an exception.
  11. Some controls were removed from WinForms. For example ContextMenu. They were replaced with a set of different controls quite some time ago but our code used an old version for some reason.
  12. In the .NET Framework, your application can load assembly A from the application directory. Later it can load assembly K located in a different directory and assembly K can load assembly A version from the same directory that contains assembly K and it will work. This will fail in the .NET 6 because another version with a higher version is already loaded. To fix this you will need to use AssemblyLoadContext.
  13. If you are using different assembly versions in WPF then it will work properly. You will have to rename assemblies to include the version in the assembly name. I spent quite a bit of time on this and I didn’t find any better way.
  14. If you are enumerating over HashSet sometimes it will contain elements in a different order in .NET 6. We found that during tests. But HashSet does not guarantee the order so it was an issue on our side.
  15. string.Compare("C-O", "CA") will return 1 for the .NET Framework and -1 for .NET 6. It is because Microsoft changed how comparing works to have the same result for all platforms. Previously it used Windows API for this.

The previous part is here.

As I wrote before our project has 824 C# projects. As you can imagine it is a lot of source code and converting so much code will take quite a lot of time. But we typically release a new version of our product every month and we definitely will not be able to finish all converting and testing within one month.

As a result, we have to create a branch and periodically merge changes from the main/master branch. But there are the following problems:

  • csproj file is for .NET 6 is very different from csproj file for the .NET Framework
  • if we change some code and this code will be changed for the .NET Framework then we will have to do tricky merges
  • it is a lot of work to convert many projects and we expect that some projects need manual conversion
  • build system needs to be changed as well to be able to build the .NET Core projects

Our company has a relatively big desktop product that still uses the .NET Framework. We tried to switch to .NET 5 in 2020 but we had one dependency that we could not make to work for the .NET Core family because it used things that were considered legacy even for .NET Framework. But this time it was way more successful and this is a story about how we were switching from .NET Framework to .NET 6 and what issues we had on our way.

But before you do anything you need to know why are you doing it. This is a really important question because such a huge change will create a lot of regression and your clients will be