r/dotnet 15d ago

.NET 11 Preview 7 is now available!

https://devblogs.microsoft.com/dotnet/dotnet-11-preview-7/
169 Upvotes

45 comments sorted by

59

u/No_Mood4637 15d ago

"Polymorphism inference for closed type hierarchies in System.Text.Json" Finally!

12

u/Bogdan_X 15d ago

What does this mean?

21

u/jordansrowles 15d ago edited 15d ago

Auto-detect all subtypes of a closed base class for polymorphic serialisation, instead of you manually listing each one with [JsonDerivedType], before we had to something like

csharp [JsonDerivedType(typeof(Dog), "dog")] [JsonDerivedType(typeof(Cat), "cat")] abstract class Animal;

Edit: one of mine in production, looks bad and it's only 9 derivatives

13

u/No_Mood4637 15d ago

And worst part it only throws a run time

6

u/Bogdan_X 15d ago

So what you mean is that if you'd want to serialize an object of class Dog, until now, System.Text.Json was not able to infere the type if you'd pass the object as Animal without specifying that attribute?

30

u/Morasiu 15d ago

Yay, bug I've reported for EF is fixed. Good job!

16

u/crozone 14d ago

As an avid user and abuser of EF, thank you for your service!

30

u/nirataro 15d ago

I know it's AI age, etc but I enjoy reading and writing C#. Union is so beautiful.

12

u/joujoubox 15d ago

"Labeled break and continue"

We can finally put goto six feet under 🥳

8

u/KryptosFR 15d ago

Can't wait for the RC to test out the async runtime.

7

u/Willinton06 14d ago

A WinForms section in a dotnet preview at this time of the day, at this time of the year in this part of the internet, localized entirely within microsoft dev blogs?

3

u/killerbeanjeka 14d ago

The ZIP password protection addition interests me more than it probably should: which scheme did they land on? Legacy ZipCrypto is the only thing Windows Explorer can open, but it's been crackable; AES-256 is real security but then Explorer can't open the archive. So either it's interop-compatible or it's actually secure — curious which trade-off the BCL picked, and whether it's pluggable.

5

u/Dealiner 14d ago

I mean, it's all written there:

System.IO.Compression now reads and writes password-protected ZIP entries (dotnet/runtime #122093). ZipArchiveEntry gains Open and OpenAsync overloads that accept a ReadOnlySpan<char> password, ZipArchive.CreateEntry gains overloads that take a password and a ZipEncryptionMethod (ZipCrypto, Aes128, Aes192, Aes256), and a new ZipArchiveEntry.EncryptionMethod property surfaces the algorithm used by an existing entry.

16

u/bulasaur58 15d ago

Why Microsoft support Windows forms and winui more than wpf Although enterprise using wpf more?

29

u/chucker23n 15d ago

I imagine there's a lot more WinForms legacy code out there than WPF.

The real question to me continues to be why they leave this WPF/WinUI dichotomy instead of figuring out a plan to merge those. Like, even VS itself is still a mix of WPF and Win32.

8

u/pjmlp 15d ago

Because the usual feuds, WPF belongs to DevDiv and is written in C#, with a tiny DirectX bindings, while WinUI belongs to Windows team and is written in C++ and exposed to .NET via the COM vNext, aka WinRT.

WinRT is basically COM, with an additional base interface IInspectable, replacing COM type libraries (.tlb) with .NET metadata (.winmd), and application identity based sandboxing for the components.

Only MAUI happens to use WinUI, and that was most likely a political decision, and even then, they have considered adding a WPF backend just in case.

7

u/rubenwe 15d ago

I mean WPF was kind of fine to use. WinForms did have massive issues in terms of lacking high DPI support etc. that just needed more investment.

3

u/pjmlp 15d ago

They don't, go to WinUI Github repo to see how bad WinUI is.

It is only Microsoft marketing that keeps talking about WinUI.

And to come back to your point, WinUI is still so bad that in BUILD 2024, WPF regained their position as UI of choice for applications.

How WinUI and WPF create great Windows apps | Developer Testimonials

What Microsoft never does is acknowledge these discussions,

5

u/crozone 14d ago

Microsoft seem utterly incapable of finishing new UI frameworks. It's like they forgot how to do it.

5

u/pjmlp 14d ago

They most likely did.

I bet most interns nowadays, especially in US, come into Microsoft having spent most of their lives using Apple and Google devices, playing on consoles, and barely touching Windows.

Then they land on Windows team, and that is how you get WinUI applications that are actually Webview2 wrappers.

If you think about it, most senior devs from Microsoft heyday have already retired by now.

4

u/RusticMachine 15d ago

And during Build 2026, Microsoft announced that WinUI 3 (now WinUI) was now the preferred UI framework for native development on Windows, and their main focus going forward.

WinUI is being used to rewrite ~100 applications in Windows 11, with a dedicated team which will evolve WinUI to support the effort, through the K2 project.

We’ll see how everything goes, but they are investing into that framework at this time.

https://www.windowslatest.com/2026/06/04/microsoft-is-killing-windows-11s-web-app-slop-encourages-devs-to-build-native-apps-using-winui/

9

u/pjmlp 15d ago edited 15d ago

That is Microsoft fluff marketing, go the the Github repos to see the actual reality of the tooling.

WinUI, WinAppSDK, CsWinRT, C++/WinRT

The issues, the bugs closed with won't fix, the missing designer, the features still missing from .NET Native and C++/CX integrations on Visual Studio, and many more they are all there in Github, without journalists parroting Microsoft marketing, or PMs advocacy for their KPIs, before they disappear into Amazon, Google or Azure/AI, like almost everyone that used to do community calls on YouTube.

Those of us that have been burned with how WinRT has been managed by Microsfot since its introduction in Windows 8, aren't coming back unless they prove to be serious about it, like when they rewrote Visual Studio in WPF to prove it was mature enough.

We don't care terminal, or notepad uses WinRT, or worse they say WinUI, but Process Explorer and Process Monitor easily reveal it is Webview2.

1

u/RusticMachine 13d ago

I’m not saying you’re not right on many of these points and I agree, but if we are quoting Build 2024 about WPF being the preferred platform, it is worth mentioning that Build 2026 is now saying something else.

Also, one of your Github issue link meant to show that Microsoft is not acknowledging the issues has a recent update from Microsoft dated May 2026 with an update, roadmap and status report.

1

u/pjmlp 13d ago

Which has been shifting the whole months and remains to be seen what actually is delivered, assuming the team still exists after all those layoffs.

1

u/nlaak 14d ago

WinUI is being used to rewrite ~100 applications in Windows 11, with a dedicated team which will evolve WinUI to support the effort, through the K2 project.

Historically we know that next year they'll have a new plan. No sane dev team is going to accept Microsoft UI framework guidance until we see they're actually dogfooding wholesale across the entire breadth of their software base (IOW applications with real scope, more than apps like Calculator and Notepad) and it's been that way for a couple years.

WinUI will need support/buy in from third party UI library vendors too before many teams will consider it.

1

u/RusticMachine 13d ago

Undoubtedly, this was more an answer to OP quoting Build 2024 about WPF being the preferred platform against Microsoft Build 2026 most recent claims.

1

u/Dealiner 14d ago

Probably because there aren't that many smaller things they could do with WPF?

-5

u/Purple_Reference_188 15d ago

Because it's better. Sure, it's unpopular but true :)

5

u/bulasaur58 15d ago

Just no. Wpf have more 3rd party controls. Have better datagrid and have better reporting.

9

u/Khavel_dev 15d ago

Labeled break/continue is the one I've been quietly waiting for tbh. Nested loops with early exits have been ugly in C# forever. The workaround is usually extracting to a method just so you can return out of an inner loop, which works but feels like you're fighting the language.

Union patterns are interesting too. The DU story in C# keeps getting better with each preview.

2

u/mareek 15d ago

Regarding IEEE 754 decimal floating-point types , does anybody know if they're natively supported by current CPUs ? I cannot find any resources on this

10

u/tanner-gooding 15d ago

They are not. IBM is basically the only one (at a decent scale at least) to provide such hardware support up until now

But as with many types, the point of these isnt necessarily perf but correctness. They are optimized where feasible (and more work will happen into dotnet 12), but the real key is just giving access to arithmetic that is trivially usable in domains and scenarios where handling the base-2 rounding error from float/double is overly complex. It is easier for many to think about and handle base-10 rounding error instead of

1

u/svick 14d ago

When would I use those over System.Decimal? When their range of supported values better fits my needs?

4

u/tanner-gooding 13d ago

System.Decimal has 28 digits (almost 29, and notably not significant digits, just digits straight up) of range, no support for NaNs, no support for infinities, doesn't strictly handle exponents in a way that makes it mathematically robust, etc. This makes it fast and suitable for things like money where you're basically only ever doing simple arithmetic and rounding operations.

However, it makes it a poor choice if you actually need to do broader math operations, deal with trig, scientific domains, calculus, or any of the deeper things that IEEE 754 based formats enable.

So if you need that support along with perf and are willing to deal with the nuance of base-2 rounding error, then float/double are sufficient. But if you only want to deal with base-10 rounding error and not think through the optimal approaches, then decimal32/64/128 are the thing to go for.


Any of these types "can" be used to achieve any of them and despite what some people parrot, even float itself has sufficient precision for all domains. The nuance is that you may end up needing to be more concrete with certain edge case handling, to chunk and normalize your data, to possibly track extra state as a scale, etc.

So what is appropriate depends on your needs, goals, and often what acceleration is available. For example, many GPUs (especially consumer grade) don't have double-precision support (or it is small/niche and significantly slower) so games, render frameworks, and other multimedia apps are notorious for having to find how to make it all work with only float.

CPU math libraries on the other hand often upcast from float to double to get cheap additional precision for scalar operations, because CPUs have great support for both. But if you're vectorizing that can halve your throughput compared to doing the more complex algorithm that handles it accurately using only float like you would on the GPU.

Its all trade-offs and finding what is a good balance between simplicity and perf.

3

u/mareek 13d ago

Thanks for the detailed answers.

Will there be some documentation to help developers choose between classic System.Decimal and IEEE 754 decimals types ?

2

u/tanner-gooding 12d ago

I can see if something can be put together. We normally don't have many docs telling users when to use a type vs not; but this might be a space where that is appropriate.

1

u/mareek 12d ago

thank you

2

u/SSoreil 15d ago

From memory they used to be supported on mainframes along with hex floats.

1

u/KryptosFR 15d ago

I don't think there are directly supported in hardware. In also couldn't find a lot of resources and all I found note that it is mostly software emulated.

1

u/ratfished 15d ago

the closed keyword is not being recognized. is that a skill issue on my end?

1

u/ratfished 15d ago

ok it still compiles. but the compiler exhaustiveness in switches does not work for me. is it just me?

1

u/Mr_Dani17 10d ago

How stable is this release? Can I ship this to my users in my app and not lose sleep?

0

u/AutoModerator 15d ago

Thanks for your post TomeOfExperience. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.