Skip to content
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

Add analyzers and code-fixes to help adoption of source-generated COM #87223

Merged
merged 21 commits into from
Jun 9, 2023

Conversation

jkoritzinsky
Copy link
Member

Fixes #86343

Also refactors a base class for our code-fixes to use that handles providing fix-all support and "enable allow unsafe blocks" support.

Interesting aspects here for the analyzer/fixer:

  • We don't offer the fixer for interfaces that use arrays as the default array marshalling experience is different between built-in COM and source-generated COM.
  • We don't offer the fixer for delegate types for the same reason.
  • We do a very simple implementation for removing shadowing members where we remove any non-static interface method with the new keyword. We can try to make this smarter (validate members against base class, etc).
  • We will need to have a corresponding (one-line) change in the SDK to expose the EnableComHosting property from MSBuild to Roslyn.

@ghost
Copy link

ghost commented Jun 7, 2023

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #86343

Also refactors a base class for our code-fixes to use that handles providing fix-all support and "enable allow unsafe blocks" support.

Interesting aspects here for the analyzer/fixer:

  • We don't offer the fixer for interfaces that use arrays as the default array marshalling experience is different between built-in COM and source-generated COM.
  • We don't offer the fixer for delegate types for the same reason.
  • We do a very simple implementation for removing shadowing members where we remove any non-static interface method with the new keyword. We can try to make this smarter (validate members against base class, etc).
  • We will need to have a corresponding (one-line) change in the SDK to expose the EnableComHosting property from MSBuild to Roslyn.
Author: jkoritzinsky
Assignees: -
Labels:

area-System.Runtime.InteropServices

Milestone: 8.0.0

@jkoritzinsky
Copy link
Member Author

Test failures are all known.

@jkoritzinsky jkoritzinsky merged commit 4d52032 into dotnet:main Jun 9, 2023
@jkoritzinsky jkoritzinsky deleted the com-migration-analyzer branch June 9, 2023 03:36
@ghost ghost locked as resolved and limited conversation to collaborators Jul 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Analyzer and Code-Fix to enable easy adoption of [GeneratedComInterface]
3 participants