Chromium based apps don't support file drop without using IDataObjectAsyncCapability. This includes the new Outlook.
To support this we'll look for this interface in our current code paths and utilize it. This makes the async operation sync, which works, but isn't ideal. Chromium will pop a dialog that will leave WinForms modal as well until it is responded to.
If this behavior creates an issue it can be disabled with the appcontext switch: "Windows.DragDrop.DisableSyncOverAsync"
In order to truly support async we're also introducing a new interface to allow calling back off of the UI thread. This will be shipped as experimental for .NET 10 as there is a small risk we'll want to change the API based on real-world feedback. See #13422.
CMake now comes with the VS
Added path to the latest SDK build
Co-authored-by: Jeremy Kuhne <jkuhne@microsoft.com>
---------
Co-authored-by: Jeremy Kuhne <jkuhne@microsoft.com>
Clarified why we have duplicate messages. We had changed Analyzer ID prefix in NET9, but we are tracking and documenting the old, NET6,7,8 IDs forcompleteness.
We had published documentation for analyzers shipped in NET9 - https://learn.microsoft.com/en-us/dotnet/desktop/winforms/compiler-messages/wfo0002?view=netdesktop-9.0
list-of-diagnostics file contains full list of the compiler warnings and errors, obsoletions, experimental features and diagnostics reported by our analyzers. This will help picking up the next number when adding a new ID. I also added notes on the updated documentation steps.
Our local analyzer help files are duplicating information from the "learn" site, but they are useful for analyzers that are shipped in preview and not yet documented. I updated these files with newer links, added missing analyzer and removed one that was duplicated in 3 files, assuming that the "learn" site is the main source of information for the users.
One of the analyzer error messages is updated to follow the common format - emphasize API name with ticks.
Removed unused diagnostic ID
Updated AnalyzerReleases files with correst history of when they were shipped and the newly published documentation links
Fixes#3783
Add controls removed in NET3.1 Back to .NET10 for binary compatibility.
None of the re-added types can be constructed, all constructors throw new PlatformNotSupportedException(), default constructors are suppressed by introducing throwing public constructors if needed.
All attributes that have been present on the .NET Framework types, are preserved, as they are accessible by reflection.
All re-introduced types are decorated with [EditorBrowsable(EditorBrowsableState.Never)] attribute that hides them from the intellisense. Type names can be typed in by the developer manually and intellisense would show the same members as it did for .NET Framework projects.
All re-introduced types are decorated with the ObsoleteAttribute that results in a compile time warning. All types share a single deprecation warning Id, to simplify suppression, but have different explanation messages.
All re-introduced types are decorated with [Browsable(false)] attribute to not show custom control properties of these types in the property browser.
All public members are re-introduced with their metadata, except for the private attributes.
Members inherited from the base classes (Control, for example) are not re-introduced even if they had been overridden in the past because they are not required for binary compatibility, unless they are decorated with different attributes.
Members that are re-added to the existing types (Form and Control) are returning defaults or doing nothing.
Non-void public or protected instance members on the restored types throw null, not the PlatformNotSupportedException to save space.
Void public or protected instance members do nothing.
Public or protected fields return default values.
Nullability is disabled for all re-added classes, structs and delegates for compatibility with the .NET Framework.
Related to ##12362
Fixes#11350
The TryGetData methods use NRBF deserializer by default and will fall back to use BinaryFormatter if the application opts into BinaryFormatter use in this context.
The GetData methods have a compatibility mode when the appropriate AppContext switches are enabled but by default they can read only known and primitive types or POCOs with primitive fields. These methods in the DataObject class are obsoleted.
* Mark the Form.OnClosed and OnClosing methods with the ObsoleteAttribute
* Mark the Form.OnClosed and OnClosing methods with the ObsoleteAttribute following the reviews
* Obsolete Form.Closed and Form.Closing events.
Suppress the warning in DesignerActionPanel
Change the Form.Closed events subscribed to in DataGridViewAddColumnDialog and DataGridViewColumnCollectionDialog to Form.FormClosed
* Update Form.Closed/Closing in project System.Windows.Forms.Design with FormClosed/FormClosing
Fix errors in comments of class FormClosedEventArgs and FormClosingEventArgs
* Update src/Common/src/Obsoletions.cs
Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>
* Update docs/list-of-diagnostics.md
Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>
* Update src/System.Windows.Forms/src/System/Windows/Forms/FormClosingEventArgs.cs
Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>
* Update src/System.Windows.Forms/src/System/Windows/Forms/FormClosedEventArgs.cs
Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>
* Suppress obsolete warnings in PrintPreviewDialog
---------
Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>
`Windows Media Player` and `Media Features` are required for building the full repo.
Without those Windows Features, the build fails with the following error:
```
C:\git\winforms\src\System.Windows.Forms\tests\AxHosts\AxHosts.Designer.cs(64,13): error CS0246: The type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) [C:\git\winforms\src\System.Windows.Forms\tests\AxHosts\AxHosts.csproj] [C:\git\winforms\src\BuildAssist\BuildAssist.msbuildproj]
```
Add a more detailed document on our team coding style.
To demonstrate code to the style standard I've updated the code in the Buttons subfolder. Also updated a few files from Primitives. Informational messages in the updated files are now greatly reduced.
Some of the things done:
- Fix spelling
- Use ternary operators
- Use target-typed new
- Fix some internal parameter names
- Use expression bodies
- Use pattern matching
- Add argument names for bools and nulls
- Remove regions
Thread static naming and shipped public API naming issues aren't easily addressable without suppressions. Added a global suppression file to suppress these particular issues to make the code less difficult to read. We shouldn't put other types of suppressions in this file.
Note that for some reason RadioButton.PerformAutoUpdates was getting the TypeDescriptor to clear sibling RadioButtons. I've set the property directly as this is significantly more performant and friendly to trimming.
PaddingConverter was unnecessarily complicated in creating it's strings. `int` to string never is impacted by culture.
Tweaks the editor config settings to encourage behavior that matches our coding style:
- We prefer `Foo foo = new()` over `var foo =`.
- `var` for built in types is an error
- Expression bodied members are always ok
A number of the rules got added by just using the editor. I'll continue to iterate.
Changed a big chunk of the code to use target typed new using fixers and regexe's for the majority of the changes.
Test fixtures do not run on the same thread the test method executes on when marked with `[WinFormsFact]` or `[StaFact]`. This change removes the test fixture and adds a new context switch to throw thread exceptions.
Initialization of the switch is done programmatically via a module initializer. The module initializer will also set the starting cursor position to avoid spurious errors in tests due to cursor positioning.
The Cursor tests were the ones modifying the cursor position and causing intermittent errors in other tests. Moved them to their own collection and forced them to run sequentially.
Cleaned up WindowsFormsSynchronizationContext.
Simplified checks in LocalAppContextSwitches. We shouldn't be conditioning on supported OS beyond checking for UI availability. We don't support Windows 7, but we won't deliberately cause WinForms apps to crash on Windows by calling later APIs without checking for support. We will not add additional complexity to the code beyond that for unsupported OS platforms.
* Fix anchored nested controls in the UserControl hosted on the Form.
This is not a regression but the root cause is different in Framework vs <NET 8.0.
Anchor calculations are delayed untill after the Handles are created. This is problematic in the scenarios where UserControls containing anchored controls are nested.
ex:
User control has a TextBox anchored in all directions.
User control is then resized on Form, TextBox anchors should have been calculated based on the UserControls original size and grow/shrink on this resize event.
However, none of the Handles are created yet and thus anchor calculations, when happen, will be done with thi snew size for UserControl.
In this change we calculate anchors when parent's layout is resumed and not wait until handles are created or not. When handles created, and DPI applied, we scale controls as well as anchors.
Fixes#6381.
* Cleanup Handle created checks.
* Fix tests and build failures.
* Fix design-time scenario.
* Address review feedback.
* Address feedback.
* Address feedback.
* Add argument names.
* Removed `DomainUpDownAccessibleObject` usage as obsolete class.
* Promote obsoletion from warning to error
* Adjust obsoletion message to include recommended replacement type
* Add removed API to PublicAPI.Unshipped.txt
Co-authored-by: Dmitrii Drobotov <v-ddrobotov@microsoft.com>