-
Notifications
You must be signed in to change notification settings - Fork 201
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
Refactor DllImportGenerator project for easier extensibility #1119
Refactor DllImportGenerator project for easier extensibility #1119
Conversation
…it's own assembly for sharing purposes.
Make the PInvoke stub code-gen less opinionated to simplify reuse for in other P/Invoke-style scenarios (like QCalls or function-pointer-based targets).
DllImportGenerator/Microsoft.Interop.SourceGeneration/IGeneratorDiagnostics.cs
Show resolved
Hide resolved
...mportGenerator/Microsoft.Interop.SourceGeneration/Marshalling/MarshallingGeneratorFactory.cs
Outdated
Show resolved
Hide resolved
DllImportGenerator/DllImportGenerator/DllImportGeneratorOptions.cs
Outdated
Show resolved
Hide resolved
Note that analyzers and source generators with dependencies do not work well due to dotnet/roslyn#41785. |
I honestly thought Roslyn had fixed that by now. |
I've converted the Microsoft.Interop.SourceGeneration package to be a source package and have the sources included in DllImportGenerator. I feel like there's something weird with using resx files in a source package, but I don't remember. If anyone else knows anything about how resource strings should be done with source packages, I'd appreciate any pointers. |
7e53797
to
7dca201
Compare
7dca201
to
458ccab
Compare
Based on offline conversations as well as the fact that the source generator cookbook has instructions for generators with dependencies, we've decided for the .NET 6 time frame to provide the Microsoft.Interop.SourceGeneration package as an assembly instead of as a source package. Since we're not actually planning on shipping it publicly for .NET 6 (same as the DllImportGenerator), we can revisit this decision in the .NET 7 timeframe. |
…elab into enhanced-extensibility
…elab into enhanced-extensibility
…atorFactory implementation to enable more localized handling of collection element marshalling support with the decorator pattern.
…elab into enhanced-extensibility
Introduce a new
Microsoft.Interop.SourceGeneration
library which contains all of our marshallers and the default implementation of our marshaller selection algorithm.Build the DllImport source generator on top of this library and refactor the guts of the P/Invoke body stub generation to be usable for more scenarios outside of
GeneratedDllImport
. For example, this model could be used for scenarios like the following:DllImportAttribute
runtime#1906 with their own GeneratedDllImport-like attribute that they provide along with their source generator.