-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add breaking change documentation for IDispatchEx to IReflect cast failure in .NET 10 #49934
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR documents a .NET 10 breaking change where casting COM objects implementing IDispatchEx to IReflect now fails instead of succeeding with unusable members.
- Adds comprehensive breaking change documentation explaining the behavioral change, reason, and recommended migration path
- Updates TOC and index files to include the new article in the interop section
- Provides clear before/after code examples demonstrating the behavior change
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| docs/core/compatibility/interop/10.0/idispatchex-ireflect-cast.md | New breaking change article documenting the IDispatchEx to IReflect cast failure in .NET 10 with code examples and migration guidance |
| docs/core/compatibility/toc.yml | Adds TOC entry for the new breaking change article in the Interop section |
| docs/core/compatibility/10.0.md | Adds index entry for the new breaking change in the Interop category |
| @@ -0,0 +1,61 @@ | |||
| --- | |||
| title: "Breaking change - Casting COM object that implements IDispatchEx to IReflect now fails" | |||
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type names like IDispatchEx and IReflect should be wrapped in backticks for code formatting according to .NET documentation guidelines. Change the title to: "Breaking change: Casting COM object that implements IDispatchEx to IReflect now fails".
| @@ -0,0 +1,61 @@ | |||
| --- | |||
| title: "Breaking change - Casting COM object that implements IDispatchEx to IReflect now fails" | |||
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to markdown writing guidelines, use a colon instead of a hyphen in the title. Change "Breaking change -" to "Breaking change:".
| @@ -0,0 +1,61 @@ | |||
| --- | |||
| title: "Breaking change - Casting COM object that implements IDispatchEx to IReflect now fails" | |||
| description: "Learn about the breaking change in .NET 10 RC 1 where casting a COM object that implements IDispatchEx to IReflect now fails." | |||
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type names like IDispatchEx and IReflect should be wrapped in backticks for code formatting according to .NET documentation guidelines. Update the description to include backticks around these type names.
|
|
||
| ```csharp | ||
| var file = Activator.CreateInstance(Type.GetTypeFromProgID("htmlfile")); | ||
| Console.WriteLine("IDispatchEx is " + (file is IDispatchEx ? "supported" : "NOT supported")); |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace at the end of the line.
| Console.WriteLine("IDispatchEx is " + (file is IDispatchEx ? "supported" : "NOT supported")); | |
| Console.WriteLine("IDispatchEx is " + (file is IDispatchEx ? "supported" : "NOT supported")); |
|
|
||
| ## Recommended action | ||
|
|
||
| The only viable question that could be asked in .NET 5+ with this cast was, "Does the type implement IDispatchEx?" In this case, the better way to ask that question is as follows: |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use second person ("you") instead of passive voice. Change "In this case, the better way to ask that question is as follows:" to "In this case, ask that question as follows:" to follow the active voice with second person requirements.
Summary
Documents the .NET 10 behavioral change where casting COM objects implementing
IDispatchExtoIReflectnow fails instead of succeeding with unusable members.Changes:
docs/core/compatibility/interop/10.0/idispatchex-ireflect-cast.mdPrevious behavior (.NET 5-9):
New behavior (.NET 10):
Recommended migration:
Fixes #46690
Original prompt
IDispatchExtoIReflectnow fails #49921✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Internal previews