Tag Archives

Archive of posts published in the tag: C#

DotNetBrowser and invalid external method call

Recently I was debugging the issue with DotNetBrowser and external call from JavaScript. I had the following:

So I configure the browser and then set external object to handle callback. The callback is a method accepting two integers. It was called using…

.NET Inside Out Part 18 — Handling StackOverflowException with custom CLR host

This is the eighteenth part of the .NET Inside Out series. For your convenience you can find other parts in the table of contents in Part 1 – Virtual and non-virtual calls in C# We saw in Part 8 — Handling Stack Overflow…

Higher Kinded Types in C# Part 3 — Heterogenous invoice

This is the third part of the Higher Kinded Types in C# series. For your convenience you can find other parts in the table of contents in Part 1 — Introduction This time we start with this invoice:

Obviously, this breaks things…

Higher Kinded Types in C# Part 2 — Homogenous invoice

This is the second part of the Higher Kinded Types in C# series. For your convenience you can find other parts in the table of contents in Part 1 — Introduction So now we can use invoice with items as Brand< Started, string>.…

Higher Kinded Types in C# Part 1 — Introduction

This is the first part of the HKT series. For your convenience you can find other parts using the links below: Part 1 — Introduction Part 2 — Homogenous invoice Part 3 — Heterogenous invoice Today we will play with higher kinded types…

Async Wandering Part 8 — async and await — the biggest C# mistake?

This is the eighth part of the Async Wandering series. For your convenience you can find other parts in the table of contents in Part 1 – Why creating Form from WinForms in unit tests breaks async? Async is one of the most…

.NET Inside Out Part 15 — Starting process on different desktop

This is the fifteenth part of the .NET Inside Out series. For your convenience you can find other parts in the table of contents in Part 1 – Virtual and non-virtual calls in C# Windows supports multiple desktops for a long time. We…

Removing Content Security Policy header from pages hosted in web view

Today we will remove Content Security Policy (CSP) header from pages hosted in web view. Technically it doesn’t matter which web view you use (whether it is IE, dotnetbrowser, CEF or whatever else). It all goes down to the same: we need to…

.NET Inside Out Part 14 — Calling virtual method without dynamic dispatch

This is the fourteenth part of the .NET Inside Out series. For your convenience you can find other parts in the table of contents in Part 1 – Virtual and non-virtual calls in C# We know that when we call virtual method we…

Caching result of any function in C++

Imagine that you are writing a top-down dynamic algorithm. You already represented your dependencies as recursive functions and now you need to figure out how to decrease the memory usage and calculate things in correct order. On the other hand, you can just…

Custom memory allocation in C# Part 13 — In-place serialization

This is the thirteenth part of the Custom memory allocation series. For your convenience you can find other parts in the table of contents in Part 1 — Allocating object on a stack Recently Jean-Bernard Pellerin showed nice tricks for binary serialization in…

.NET Inside Out Part 10 — Using type markers for low level optimizations

This is the tenth part of the .NET Inside Out series. For your convenience you can find other parts in the table of contents in Part 1 – Virtual and non-virtual calls in C# If you are interested in the topic see the…

Decreasing pain of stolen focus

One of the most irritating thing in Windows is no way to prevent an application from stealing focus. There are multiple questions on Stack Overflow regarding the issue, there are rumors that Microsoft wanted to do something but they cannot detect it reliably.…

Custom memory allocation in C# Part 12 — Hiding objects from GC

This is the twelfth part of the Custom memory allocation series. For your convenience you can find other parts in the table of contents in Part 1 — Allocating object on a stack We already know how to allocate memory anywhere on the…

Running On Screen Keyboard in Windows 10 in C#

Today something supposedly very simple. How to run On Screen Keyboard from C#? Easy enough you say and type the following code:

And then you compile it as Any CPU, run on Windows 10 x64 and you get the following error: What…

.NET Internals Cookbook Part 12 — Memory structure, attributes, handles

This is the twelfth part of the .NET Internals Cookbook series. For your convenience you can find other parts in the table of contents in Part 0 – Table of contents 82. What is a bit-mapped attribute? Custom attribute? Pseudo-custom attribute? There are…

.NET Internals Cookbook Part 11 — Various C# riddles

This is the eleventh part of the .NET Internals Cookbook series. For your convenience you can find other parts in the table of contents in Part 0 – Table of contents 75. What is the TimeSpan resolution? It’s 100 nanoseconds, as specified by…

.NET Internals Cookbook Part 10 — Threads, Tasks, asynchronous code and others

This is the tenth part of the .NET Internals Cookbook series. For your convenience you can find other parts in the table of contents in Part 0 – Table of contents 65. How can you await async void method or catch exceptions thrown…

.NET Internals Cookbook Part 9 — Finalizers, queues, card tables and other GC stuff

This is the ninth part of the .NET Internals Cookbook series. For your convenience you can find other parts in the table of contents in Part 0 – Table of contents 59. What happens if an exception is thrown in finalizer? What about…

.NET Internals Cookbook Part 8 — C# gotchas

This is the eighth part of the .NET Internals Cookbook series. For your convenience you can find other parts in the table of contents in Part 0 – Table of contents 52. Can you have class in a class? Class in an interface?…