Live data from Hacker News

I found a bug in the .NET framework and fixed it by hand-altering the DLL

blog.nullspace.io

1–10 of 124 posts

Re: I found a bug in the .NET framework and fixed it by hand-altering the DLL

#4

My knowledge of the GAC is out of date but isn't a bit of a security hole that you can replace that DLL?

You need to be a local administrator to write to the GAC by default. See http://msdn.microsoft.com/en-us/library/yf1d93sz(v=vs.110).a...

So if you can modify the files in the GAC, you're already compromised at that point.

Re: I found a bug in the .NET framework and fixed it by hand-altering the DLL

#5
Wow, that is some fancy work. Though I shudder to think about deploying and maintaining that fix, and bringing new developers up to speed on why and how it was done.

I was also about to tell him to skip all the ildasm stuff and just use the online reference source (referencesource.microsoft.com) ... but that assembly isn't in there. So I guess ildasm was the best option.

Re: I found a bug in the .NET framework and fixed it by hand-altering the DLL

#6

My knowledge of the GAC is out of date but isn't a bit of a security hole that you can replace that DLL?

They didn't replace it - it looks like they created a new assembly with its own strong name, registered it alongside the 'official' assembly, and referenced their assembly in place of the .NET native assembly at compile time.

What's maybe surprising is that the C# compiler generated code 'adopts' the types in their hacked expressions library. But the C# compiler, wherever it depends on particular types that need to exist for it to do its thing, has always generally relied on finding those types by -name-, not by -name and assembly strong name-.

For example, the C# 3 compiler understands the calling and declaration syntax of extension methods, but to compile an extension method, it requires an Attribute type - System.Runtime.CompilerServices.ExtensionAttribute - which was only introduced into .NET in v3.5. But if you make an attribute class with that name available to the C# compiler, you can compile code using C#3 extension method syntax against the .NET 2.0 framework libraries.

Re: I found a bug in the .NET framework and fixed it by hand-altering the DLL

#7
The real news here is that this is considered special.

In most other languages, they'd have forked the source, fixed it, recompiled it for their own uses and submitted a pull request or patch.

I'm a big .NET fan, but the fact that we have to jump through such hoops to find and fix a bug, and then still have near certainty that we're going to have to reapply the patch for many updates to come, well, that's just a bit sad. It feels rather last-century, to be honest. Microsoft could save a lot of double work if they'd just open source .NET and attach a decent process to it. They can still be the Linus. Just consider my patches.

Re: I found a bug in the .NET framework and fixed it by hand-altering the DLL

#8
post #7

The real news here is that this is considered special. In most other languages, they'd have forked the source, fixed it, recompiled it for their own uses and submitted a pull request or patch. I'm a big .NET fan, but the fact that we have to jump through such hoops to find and fix a bug, and then still have near certainty that we're going to have to reapply the patch for many updates to come, well, that's just a bit…

I work at a startup that uses almost all open source tools for our stack. To not be able to fork, fix, pull request a bug in software seems...barbaric to me.

Re: I found a bug in the .NET framework and fixed it by hand-altering the DLL

#9
post #7

The real news here is that this is considered special. In most other languages, they'd have forked the source, fixed it, recompiled it for their own uses and submitted a pull request or patch. I'm a big .NET fan, but the fact that we have to jump through such hoops to find and fix a bug, and then still have near certainty that we're going to have to reapply the patch for many updates to come, well, that's just a bit…

---Author here---

I should disclose that I actually work for Microsoft, and still chose the hard way. Fuck the police!

Post reply on HN