-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
compilation gives error SYSLIB1094 for a GeneratedComInterface interface deriving from an interface in another project #102602
Comments
Tagging subscribers to this area: @dotnet/interop-contrib |
We can't reliably support cross-project COM interface inheritance as we can't determine vtable offsets won't change. Let's take the following example: A.dll has the following type: [GeneratedComInterface, Guid("68207504-314f-492a-b4f2-fbc1838e6ac3")]
public partial interface IMy
{
void MyMethod();
} B.dll has the following source code and references A.dll: [GeneratedComInterface, Guid("755293e8-fe80-4654-aee3-732fefaaf3e0")]
public partial interface IMy3 : IMy
{
void MyMethod3();
} At build time, A.dll's But, if the developer of A.dll updates [GeneratedComInterface, Guid("68207504-314f-492a-b4f2-fbc1838e6ac3")]
public partial interface IMy
{
void MyMethod();
void MyMethod2();
} Then However, B.dll's It is a breaking change to add methods without default implementations to .NET interfaces and it is a breaking change to add methods to a COM interface (which is why we have things like As a result, we have decided initially to not support cross-assembly inheritance for COM interfaces. The exception in VS shouldn't be happening though, so I'll definitely investigate that. Once that's fixed, I'll keep this open as a tracking issue for supporting cross-assembly COM inheritance. |
Hi, I know some people have always been giving that "adding a method is kinda ok" hack advice, but still, changing (adding or removing methods on a COM interface) is not only a breaking change, it's disallowed and has always very clearly been https://learn.microsoft.com/en-us/windows/win32/com/interface-pointers-and-interfaces:
So, you decide to disallow a perfectly valid (and common) COM usage to enable a perfectly invalid one? That seems a strange decision IMHO (and kinda contradicts the way you handle what could be considered a "niche feature" like in this other thread #101242 althought here, adding a method is not even a feature, it's a hack). |
Description
I have two projects, one console app project, referencing another class library project. One interface
IMy
is declared in the class library, and another interfaceIMy3
is declared in the console app and derives fromIMy
Both projects are using ComWrappers source generation feature (
GeneratedComInterface
).I cannot compile the console application.
Reproduction Steps
Here the class library project:
Contains only one file IMy.cs:
Here's the console app project:
contains only one file Program.cs:
Expected behavior
I don't see why it shouldn't compile, I hope this simple scenario is supported.
Actual behavior
I get compilation error:
Also, independently from the SYSLIB1094 error, Roslyn seems to crash (but not always, seems more a background thing) this is what I see (sometimes) in Visual Studio and it seems somehow related (I have a bigger project where these top error lines popup continuously):
Here is the stack trace from the first error line:
Regression?
I don't tink so but I can't be sure.
Known Workarounds
I don't have any.
Configuration
.NET 8.0.5, Visual Studio 17.10.0 (latest), Windows 11 x64
Here's a reproducing solution
AotTest.zip
Other information
No response
The text was updated successfully, but these errors were encountered: