Don't look at the sourcecode of .NET licensed under the 'Reference license'

Update: If you think I should be shouting 'awesome' and similar words like most of the .NET community members, please take a walk down the path of 'licenses', something you all should be familiar with in every cell in your body, but by the look of all the different posts about this source release I can only conclude: hardly anyone has any clue whatsoever what licensing, copyright, software patents and related material really mean to a software developer. You didn't really think that by copying a class from the internet you owned the code, did you?

If you do framework development, take my advice and don't look at the .NET 3.5 BCL sourcecode. Using reflector isn't the same, you're then looking at IL being reversed engineered. Looking at sourcecode is different: it has comments, it has other layout, it has real variable names etc. etc. Also, use reflector only when you really have to. Using it is technically breaking the EULA.

Why you shouldn't look at that sourcecode
The reason is simple: software patents. People in the EU, where software patents are, fortunately, still not valid, should still realize that in other countries they do exist, and if you're writing software which could be sold in the US, don't make the mistake your code is liable to this. The jurisprudence on 'reverse engineering' is based on the fact that the people who are allowed to reverse engineer code have never layed eyes on the real code. As soon as they do, they can't reverse engineer the code anymore to their own benefit (whatever that may be, even rewriting code because it's internal in the BCL) because their case would fall outside the jurisprudence: it can be assumed they might have just copied the code instead of reverse engineered it.

Do realize that you're not allowed to rebuild that code, you're not allowed to modify it, copy it etc. You're only allowed to look at it, but also because you're not allowed to copy it, you have to forget what you saw, because if you don't forget it, and borrow the ideas in that code, you likely will step on some patent.

Take for example the new ReaderWriterLockSlim class introduced in .NET 3.5. It's in the System.Threading namespace which will be released in the pack of sourcecode-you-can-look-at. This class is a replacement for the flawed ReaderWriterLock in the current versions of .NET. This new lock is based on a patent, which (I'm told) is developed by Jeffrey Richter and sold to MS. This new class has its weaknesses as well (nothing is perfect). If you want to bend this class to meet your particular locking needs by writing a new one based on the ideas in that class' sourcecode, you're liable for a lawsuit as your code is a derivative work based on a patented class which is available in sourcecode form.

Software patents are evil and the release of this sourcecode doesn't help one bit, on the contrary. If you take your profession seriously, if you are interested in learning ideas about software engineering, instead of looking at that code, read scientific papers and learn from these. Dull crap which is out of touch with reality? Yeah right (just a few examples to get your appetite fired up ).

It's a red herring
Yes, I'm negative about this move. The main reason is that doesn't solve real problems at all. Take for example the case where you detect a bug in the BCL. You plow through the source-you-can't-touch and you'll discover the place where the bug originates and see how to fix it. You can't do a thing about it. You can't fix it yourself because you can't rebuild it. You can only report it back to MS and wait for a fix. Well, dear reader, good luck with that: even if Microsoft is willing to honor your request and patch it in a short time interval (read: month or so), you'll be handed a hotfix you can't distribute to your customers. They individually have to call PSS to get the fix, or you have to hope MS will release it publically which they've done with some fixes but hardly all of them.

Sure, be happy with your shiny sourcecode-you-can't-touch, but it's not something you would want: if Microsoft would have done this for the users of the code, namely the developers, they would have made the license less restrictive, at least that you could re-compile the code to include your own bugfixes till Microsoft would release them themselves.

Published Thursday, October 4, 2007 11:18 AM by FransBouma

Comments

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 6:01 AM by Ola

Ye, ye, ye.. But the release of the source code is still great for several things! You are able to debug using the real source code and can see what is actually going on under the hood, and by doing so probably better understand why your own source code is acting the way it does.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 6:34 AM by commenter

BTW, your post reminded me of the time I made a bug report to Microsoft, in which I mentioned that I'd used Reflector to decompile some of the .NET framework. Luckily they didnt sue me :)

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 6:36 AM by commenter

Sorry to keep chipping in with new comments, but in reference to your complaint that it's not permitted to compile the source: I cannot even begin to imagine the mess which would occur if people started compiling their own forks of the .NET framework, to get round bugs they'd found!

Come to think of it, you probably meant pulling out chunks of the framework and modifying those, and compiling them separately.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 6:41 AM by Chris Martin

"But the release of the source code is still great for several things! You are able to debug using the real source code and can see what is actually going on under the hood,"

What bothers me about this statement is that it implies that you don't trust the framework.

I have enough troubles in my life. The last thing I want to worry about is why ASP.NET doesn't behave the way I expect it to. God forbid I have dig into the actual code to understand it. This is supposed to be the GOD framework. You know, it's from Microsoft after all!

And people wonder why there are alternative and exciting frameworks popping up. And why MS is copying anything that's useful.

Thanks, MS, for the CLR though.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 6:41 AM by alessandro

I do not think people today are looking into compiling the .net framework source code and making their own distributions(this is only going to bring more problems than solve any). Reference license seems to be perfect in providing only the short comings we are facing today. Had they given us a do what you want license with the .net framework, as a web developer, i wouldn't know what to do with that. As a desktop dev, i wouldn't know what to do with that either and making a fix and bundling that along with my client application does not seem to be viable either. That would mean me distributing my own custom version of the .net framework which would simply bloat my app, and more to download for the client apart from being an added frustration. Having said that, I'm all for opensource and free, just don't see the added benefit to the average joe, still, don't you already have that ? -->> mono

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 6:49 AM by Chris Martin

I guess .NET developers just don't get OSS at all. It's not about rolling your own version at all. It's about fixing stuff that's broken....

God. I don't know why I even try with this crowd!

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 7:09 AM by FransBouma

I also don't think people want to distribute their own .NET framework, that would be silly. What they for example would do is pick the DataGridView and update the paint routine so it's not so horrible slow and ship ONLY THAT updated class.

The framework indeed should do what it should do, debugging into .NET's sourcecode won't be that helpful anyway I think, simply because what will you do with the info you gather from it? The only benefit of it: patch bugs, is out of the question.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 7:44 AM by Mark Freedman

Wow, this is one negative and fear-inducing post.  Do you really believe some of these examples would hold up in court?  Should I also never speak to anyone on the .NET development team for fear that they may help me out with a coding technique that Microsoft will come back and claim is based upon patented ideas ("we own that employee, so his brain is ours")?  Has it come to this?

Also, people love looking at this stuff for the sake of learning.

Maybe I'm naive, but I think you're overreacting.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 7:55 AM by FransBouma

Mark: if you've ever read for example an NDA contract, you will understand that you shouldn't be too naive. For example, I can't speak to anyone about what I hear under NDA (not even to my wife). Silly? Why can't I speak to my wife about it? Well, it's in the contract.

A license is also a contract. You accept the license and if the license clauses aren't violating the law, they're valid and you're bound by them.

You may be naive in thinking that it won't happen to you, and it might well not happen to you. But you don't know what will happen in a few years time when the code you wrote today is perhaps important to MS. What will happen then?  Of course, if you're not willing to think of that, don't bother and live your life on the fast lane, where only the unlucky ones get scr*wed over. However, do realize that IF you take the risk, you might lose. And IF you lose, you will likely lose more than a few pennies.

And for learning? Learning what exactly? How to code? You don't learn that by looking at MS' code. You learn that from a book and by doing.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 8:45 AM by commenter

"What bothers me about this statement is that it implies that you don't trust the framework."

Chris, may I come and live with you in magic fun world, where all the frameworks are perfect? ;-)

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 8:46 AM by commenter

"I guess .NET developers just don't get OSS at all."

What's OSS got to do with this?

"God. I don't know why I even try with this crowd!"

It's tough at the top.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 11:09 AM by Chris Pietschmann

"I also don't think people want to distribute their own .NET framework, that would be silly. What they for example would do is pick the DataGridView and update the paint routine so it's not so horrible slow and ship ONLY THAT updated class." - FransBouma

Umm... Have you ever heard of object inheritance and overriding functionality of the base object? I wouldn't copy the entire code for the DataGridView, instead I would override only the functionality I want to improve or do differently.

I think you're just overreacting a little bit about this.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 11:12 AM by foobar

I am not a lawyer (and neither are you).

This argument is silly.

First off, you base your argument on hearsay - a patent that may or may not exist that may or may not have been sold to Microsoft.

Secondly, you provide no proof of your "nightmare" scenario.  I would hardly consider subclassing a type to be a patent violation (if it was that easy, someone would've patented strings eons ago, for crying out loud).  The patent holder must also take some steps to defend their patent, so at the very least they would make the type sealed, and _not release the source code for it_.

Thirdly, proving that a software patent was violated is extremely difficult.  Unlike yourself, I actually have spoken to patent lawyers about getting some software I created patented.  Their response was, "yes, you can, but it's expensive, tedious, exposes your source code (after all, you need to describe what it is that your software does), and enforcing your patent is nigh impossible."

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 11:31 AM by FransBouma

"Umm... Have you ever heard of object inheritance and overriding functionality of the base object? I wouldn't copy the entire code for the DataGridView, instead I would override only the functionality I want to improve or do differently. I think you're just overreacting a little bit about this."

Chris: of course I've heard about inheritance, but often this isn't possible (e.g. sealed classes, or the part you want/need to adjust isn't virtual), and the example I used is precisely that: the # of paint calls and when they happen is off. This means that even though you can override things, it's not going to work that great.

Reflector is different because it's reverse engineering, it's not looking at the actual sourcecode: you're doing the same as the VM is: it's 1:1 info from the IL.

Foobar: so you're not a lawyer still you claim that my argument is silly. :) Funny.

If it's so hard to enforce, why are there even lawsuits about patents? (and not 1 or 2)

But it's your life and money, so if you think I'm nuts and my advice stinks, don't bother and do what you think is best :). All I'm saying is that it's not as rosy and cheery as it might look like: there are downsides to clicking 'OK' on the license agreement dialog, and more than often people simply don't give a hoot or don't even understand what they're doing and click OK.

I might not be a lawyer, but I have spend a lot of time on licensing, patents and the like, because it involves my everyday business as an owner of an ISV which sells software for .NET, which oh, competes with parts of .NET next year.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 11:55 AM by GlenG

heehee..  I wonder how long it will be before MS removes Frans' MVP status...

Not only are you competing with MS from next year, but you are p*ssing on their big "aren't we nice fellas by releasing some source for you to look at" parade. ;-)

Go Frans.. you tell 'em man!

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 11:56 AM by Haacked

C++ developers have had the ability to look at the source code (and step into it) for MFC/ATL for years.

What's different about this situation that would cause such a freeze that we didn't see before?

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 12:27 PM by FransBouma

Phil: If I'm not mistaken, you were allowed to alter the ATL code / MFC code if you needed to, so the license wasn't as restrictive as it is with this. So I also don't understand why they moved into this direction all of a sudden...

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 1:31 PM by Andrey Shchekin

After I read this I still have one question. How could I possibly prove that I haven't looked at source code if I didn't?

Following your logic, if I looked at MS source, any code written by me can be proven to be a rewriting of MS ideas. But if my code is actually clean code right out of my head and even if I never looked at the .Net Framework source, how do I prove that I never did?

Or if I am presumed innocent, why is not my code (not copied form MS source) can not be presumed innocent even if I did look at the MS source?

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 2:16 PM by Mark Freedman

Frans, I definitely understand an NDA; I believe this is a separate issue. From what I've read, I doubt that even portions of most software licenses would completely hold up in court.

Concerning learning, I completely disagree -- why do you think that no one could learn by reading MS code?  Some of the smartest people in the world coded .NET.  Who said that this would replace books and coding for learning?  It supplements it.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 2:31 PM by FransBouma

Andrey: you'll never be sure, but at least you can protect yourself better by not accepting that license, that way you can at least protect yourself from accusations that you did accept the license and thus have looked (and access and thus likely) copied the code from MS.

Mark: I agree that in front of a court, it's a gamble what the outcome might be. My parents-in-law were both judges (father passed away unfortunately), so I know a little bit how judges look at computer software (they in general have no clue whatsoever, sadly enough).

"Concerning learning, I completely disagree -- why do you think that no one could learn by reading MS code?  Some of the smartest people in the world coded .NET.  Who said that this would replace books and coding for learning?  It supplements it."

Computer code is the RESULT of a projection of a design (algorithms, ideas) onto text so it can be used in executable form. What you WANT is to look at the SOURCE of the projection, not the end result. You can't see what the decisions were why the code is written the way it is written. So the only possible thing you can learn is perhaps a tiny coding trick here and there, and even then...

I don't see how you can learn anything really useful from a pile of sourcecode you don't have the design decisions of.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 4:26 PM by rternier

I agree that this is something people should be "aware" of, and I will eat my shorts if I see MS sue anyone for "patent" infringment.

Unfortunately, almost any contract can be argued in any cour of law, including NDA, and ULA's. As was mentioned before, just copying an idea, even if you've never seen the original, is infringing on somsone's patent/copyright.

The fact that we can get into MS's code and see what makes things ticks helps us work with it. Albeit, some might take exactly what MS does and copy it to be their own, and I doubt MS will unleash their hounds on that poor person.

If they did that... the .NET community would be in shock and MS will lose what it's been trying to build for years - us.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 4:26 PM by Marcos

Frans

You need a monument =)

You always look at the other side of things, the MS marketing guys must hate you, LoL

I cant simply understand how a lot people think that this is a glory, maybe is because I don't do ASP.NET and all are talking about stepping inside ASP:NET methods, in Windows Forms, with all the overloads, internal, and API calls we can lose 2 hours watching code instead of producing real code.

I think that for beginners that's not good either, they will be more confused that anyone, this is a feature for advanced users not beginners, I cant understand why all said: "wow great for learn and beginners"

Anyway 10 points again for u

Cheers

Marcos

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Thursday, October 4, 2007 7:06 PM by Mats Helander

@Chris Martin

"I guess .NET developers just don't get OSS at all. It's not about rolling your own version at all. It's about fixing stuff that's broken...."

Surely there are lots of values - different values to different people, even? For example, one of the most valuable aspects of open source to me actually lies in just looking at the code and learning more about good coding practices, tricks, etc. For me, a look-but-don't-recompile licence would be fine as long as I could feel safe that just by looking at the code (or clicking I Accept in whatever popup with 5 billion words MS throws at me when I install this) that wouldn't somehow legally "taint" me (as for example by disallowing me to reverse engineer by European laws, if I understand correctly?). As it stands, I'll wait and, ahem, don't see until sharper minds than mine conclude if it is safe or not.

@Frans,

I don't quite understand your argument about software patents though - if I break a patent in my code, I'm still accountable even though I haven't in fact looked at the code I infringe upon, right? Even if I haven't ever heard of it, yes? So what does it matter from a patent perspective if I look at the code? I could possibly see copyright issues stemming from that, but I don't get the patent angle.

/Mats

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Friday, October 5, 2007 4:22 AM by FransBouma

rternier: I remember an add-in for vs.net about testing... Did everyone in the .NET community get up and shout ? no. Just a couple.

Mats: It's about defending yourself. A judge will not buy your argument you wrote the code yourself if you had the oppertunity to copy code and your code looks very very similar. A judge COULD buy your argument if you didn't have the oppertunity to copy code and your code looks different.

I wrote a more bigger reply here:

ayende.com/.../Microsoft-and-opening-the-code-damned-if-you-do-damned.aspx

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Friday, October 5, 2007 5:36 AM by alessandro

Just wanted to say, this post you made frans, is much appreciated. In effect, it got me and a couple of others on irc started on an argument.

We did enjoy arguing, and i put up the live chat session here : weblogs.asp.net/.../releasing-the-source-code-for-the-net-framework-libraries.aspx

enjoy.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Friday, October 5, 2007 10:32 AM by Pazu

Happy old Europe with no software patents. Hope they'll be smart enough in EC to never introduce them.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Friday, October 5, 2007 9:49 PM by Rydal

I'm not too worried about bugs that I can't fix, I'm excited because I'll learn a lot from it and get a better insight of how it works. I've always written my own if another doesn't work. I've been using the framework since it was conceived and I've found so many, however, that has never stopped me from moving on with my project.

# re: Don't look at the sourcecode of .NET licensed under the 'Reference license'

Wednesday, October 10, 2007 8:35 AM by BlackTiger

Here is simple solution - DON'T WORK WITH US COMPANIES! It's easy! :)

If patents/licenses/other-bloody-stuff make your life worse than avoid and ignore them. It's easy too.

Most of the US "patent holders" are morons. How many of them use own "patents" in OWN everyday business? Almost nobody. They'rejust waiting for chance to fill law-suite against somebody and get some easy money. Morons. US patent system is completely rotten. It's wrong. It's only about money.