-
Notifications
You must be signed in to change notification settings - Fork 5k
.NET 10 Preview 1 - WinForms Release Notes #9722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4e5afc6
First draft
merriemcgaw 9a1c33f
Added AI message
merriemcgaw dbf3d0f
Update release-notes/10.0/preview/preview1/winforms.md
merriemcgaw 70d748b
Applying feedback
merriemcgaw a3b2000
Merge branch 'main' into WinFormsPreview1
richlander dbc59d5
Merge branch 'dotnet10p1' into WinFormsPreview1
richlander dd13cca
Applying final feedback
merriemcgaw 3b03b2e
Best Practices
merriemcgaw 35595cb
Final round of feedback
merriemcgaw fb90daf
Update release-notes/10.0/preview/preview1/winforms.md
Tanya-Solyanik 1e3be58
a bit of cleanup
jamesmontemagno 18a3b3a
Update winforms.md
merriemcgaw aba1f12
duplicated content
merriemcgaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,71 @@ | ||
| # Windows Forms in .NET 10 Preview 1 - Release Notes | ||
|
|
||
| .NET 10 Preview 1 includes new Windows Forms features & enhancements: | ||
| WinForms continues to ease the pain of migrating away from BinaryFormatter in .NET 10 Preview 1 by simplifying Clipboard serialization for certain custom types. In .NET 9, calls to BinaryFormatter to perform serialization were updated to throw `PlatformNotSupportedException` if the developer did not reference an unsupported compatibility package and enable BinaryFormatter via an application configuration switch([see more](https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-migration-guide/compatibility-package)). Clipboard and Drag/Drop scenarios which use custom types, as of .NET 9, require the developer to either enable BinaryFormatter or explicitly take action to use JSON serialization (or similar) to succeed. In .NET 10 Preview 1, WinForms is introducing APIs to help simplify the process of JSON serialization in Clipboard and Drag/Drop scenarios and obsoleting existing APIs to continue to encourage developers to move away from the unsafe BinaryFormatter serialization. For cases where BinaryFormatter is still required, a configuration switch has been added. | ||
|
|
||
| - [Feature](#feature) | ||
|
|
||
| Windows Forms updates in .NET 10: | ||
| For in-depth discussion of the APIs involved, and usage examples, please see the original [API Proposal](https://github.com/dotnet/winforms/issues/12362) in the WinForms repo. | ||
|
|
||
| ### Obsoleted APIs | ||
|
|
||
| In .NET 10, WinForms has marked as obsolete the following APIs to help warn developers that BinaryFormatter may be used to deserialize data. For detailed usage information, please see the API proposal located *An external link was removed to protect your privacy.*. | ||
|
|
||
| **Clipboard:** | ||
|
|
||
| - `public object GetData(string format)` | ||
|
|
||
| **DataObject:** | ||
|
|
||
| - `public virtual object? GetData(string format)` | ||
| - `public virtual object? GetData(string format, bool autoConvert)` | ||
| - `public virtual object? GetData(Type format)` | ||
|
|
||
| **ClipboardProxy (VisualBasic wrapper for WinForms Clipboard):** | ||
|
|
||
| - `public object GetData(string format)` | ||
|
|
||
| ### New APIs | ||
|
|
||
| We’ve introduced the following APIs: | ||
|
|
||
| **Clipboard:** | ||
|
|
||
| - [What's new in Windows Forms in .NET 10](https://learn.microsoft.com/dotnet/desktop/winforms/whats-new/net100) documentation | ||
| - `public void SetDataAsJson<T>(T data) { }` | ||
| - `public void SetDataAsJson<T>(string format, T data) { }` | ||
| - `public void SetDataAsJson<T>(string format, bool autoConvert, T data) { }` | ||
| - `public virtual bool TryGetData<T>(out T data) { }` | ||
| - `public virtual bool TryGetData<T>(string format, out T data) { }` | ||
| - `public virtual bool TryGetData<T>(string format, bool autoConvert, out T data) { }` | ||
| - `public virtual bool TryGetData<T>(string format, Func<Reflection.Metadata.TypeName, Type> resolver, bool autoConvert, out T data) { }` | ||
|
|
||
| **IDataObject:** | ||
Tanya-Solyanik marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - `bool TryGetData<T>(out T data);` | ||
| - `bool TryGetData<T>(string format, out T data);` | ||
| - `bool TryGetData<T>(string format, bool autoConvert, out T data);` | ||
| - `bool TryGetData<T>(string format, Func<Reflection.Metadata.TypeName, Type> resolver, bool autoConvert, out T data);` | ||
|
|
||
| **Control:** | ||
|
|
||
| - `public DragDropEffects DoDragDropAsJson<T>(T data, DragDropEffects allowedEffects, Bitmap? dragImage, Point cursorOffset, bool useDefaultDragImage)` | ||
| - `public DragDropEffects DoDragDropAsJson<T>(T data, DragDropEffects allowedEffects)` | ||
|
|
||
| **DragDrop:** | ||
merriemcgaw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - `public static DragDropEffects DoDragDropAsJson<T>(DependencyObject dragSource, T data, DragDropEffects allowedEffects)` | ||
|
|
||
| **ClipboardProxy:** | ||
|
|
||
| - `public void SetDataAsJson<T>(T data) { }` | ||
| - `public void SetDataAsJson<T>(string format, T data) { }` | ||
| - `public bool TryGetData<T>(string format, out T data) { }` | ||
| - `public bool TryGetData<T>(string format, System.Func<System.Reflection.Metadata.TypeName, System.Type> resolver, out T data) { }` | ||
|
|
||
| ### New Configuration Switch | ||
|
|
||
| If an application is unable to adopt the new APIs, and requires a fallback to BinaryFormatter serialization during Clipboard and Drag/Drop operations, the developer will need to take additional action. In .NET 9, calls to BinaryFormatter will always throw a `PlatformNotSupportedException` unless the developer follows the instructions *An external link was removed to protect your privacy.*. In .NET 10 Preview 1, WinForms will now also by default disable the use of BinaryFormatter as a fallback unless it is explicitly enabled with this new configuration switch. This switch is `ClipboardDragDrop.EnableUnsafeBinaryFormatterSerialization`, and it must be set to `True` for the fallback to happen successfully. | ||
merriemcgaw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Windows Forms updates in .NET 10: | ||
|
|
||
| ## Feature | ||
| - [What's new in Windows Forms in .NET 10](https://learn.microsoft.com/dotnet/desktop/winforms/whats-new/net100) documentation. | ||
|
|
||
| This is something about the feature | ||
| **AI-assisted content.** This article was partially created with the help of AI. An author reviewed and revised the content as needed. Learn moreAI-assisted content. This article was partially created with the help of AI. An author reviewed and revised the content as needed. [Learn more](https://devblogs.microsoft.com/principles-for-ai-generated-content/) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.