📜 ⬆️ ⬇️

Funny bugs and features in Visual Studio and .NET

image
In this small article I would like to share with you a couple of funny bugs (or features) of Visual Studio \ .NET and maybe hear from you about some others. Of course, the bugs themselves in the above-mentioned products actually were (there are) many and can be found on the specialized website connect.microsft.com . I wanted to talk about the most amusing in my opinion.


Magic characters

I ran into the first bug personally on a Jabber-client project on WPF — when I tried to get a topic from a conference on Jabber.ru, the client was stupidly hanging. Having spent a lot of time debugging, I removed the TextBox that displays the text of this very topic and everything worked, i.e. localized the bug in the actual display of the text on the UI. Gradually cutting characters from the text found that the problematic characters are "ﻠ́ﭑ". It turned out that when you try to insert these characters into any WPF application (in particular, code editors in Visual Studio 2010), it immediately drops or hangs to death (could not be played back in Silverlight). The bug was sent to connect.microsoft.com, they found out that there was a bug in the rendering of Arabic fonts in DirectX and then fixed it (it was 2 years ago). Visual Studio 2012 is no longer playing. On jabber.ru, by the way, they no longer allow Arabic characters to be inserted by replacing them with asterisks (and they had previously written an automatic politically incorrect answer, which I will not quote).
Summary: Paste "́ﭑ" in Visual Studio 2010 or any other WPF application.

The number of the beast

Try copying the following line in Visual Studio, then comment out and comment out again:
int אב = 666;
I will not describe anything - just try.
')

Generics, generics, generics!

Create a simple console C # .NET project and paste the following code anywhere:

class X<A, B, C, D, E> { class Y : X<Y, Y, Y, Y, Y> { YYYYYYYYY y;} }

After a long compilation, you will see that the size of the resulting assembly with a couple of kilobytes unexpectedly grew to 29mb (!). I never managed to open this assembly with a reflector, so we can say that this is one of the obfuscation options :-). In Java, with such code, as far as I know, things are even worse.
"Weaken" the design to

class X<A, B, C> { class Y : X<Y, Y, Y> { YYYYYY y;} }

and see what dotPeek will show us (“reflector” from JetBrains): Result on pastebin.com . I think you already understand that this is a “feature” of the compiler that expands YYYYYY y.

And what funny bugs do you know,% username%?
PS: Sorry for the loud title, it’s still not the bugs of Visual Studio, but the underlying tools, but I just merged them.
PS2: 2nd and 3rd bug peeped at the dotnet@conference.jabber.ru conference

Source: https://habr.com/ru/post/164571/


All Articles