What other silent changes did happen from .Net Fra

2019-03-20 09:01发布

问题:

We want to switch to .net 4.5 cause it offers many improvements.

But...sometimes I found some tricky details about not trivial changes in the framework.

Lets look for TPL unobserved exception handling as an eample:

If you do not wait on a task that propagates an exception, or access its Exception property, the exception is escalated according to the .NET exception policy when the task is garbage-collected. (note, there is no link or clarification for the term "exception policy")

Well, that is seemingly the behavior as it was in .Net v.4.0

But Stephen Toub tells us more:

To make it easier for developers to write asynchronous code based on Tasks, .NET 4.5 changes the default exception behavior for unobserved exceptions. While unobserved exceptions will still cause the UnobservedTaskException event to be raised (not doing so would be a breaking change), the process will not crash by default. Rather, the exception will end up getting eaten after the event is raised, regardless of whether an event handler observes the exception. This behavior can be configured, though. A new CLR configuration flag may be used to revert back to the crashing behavior of .NET 4.
Note that this change doesn’t mean developers should be careless about ignoring unhandled exceptions… it just means the runtime is a bit more forgiving than it used to be.

That is a great surprise. Taking into account there is no update in documentation.

So, I'd like to know what other "silent" changes I'd better know about happened in .Net v4.5
Please, share your knowledge.

P.S. Here word "silent" means the changes which hardly get known from Wat's New articles or even official documentation.

回答1:

The .NET Framework breaking change document calls this out (and more!).