-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Reference type in public field causes TypeLoadException for Com Interop #47849
Comments
@BickelLukas Can you provide some more details on how to reproduce this? Support for For example, see #13192 |
@AaronRobinsonMSFT I did have a Breakthrough on this yesterday and was able to use the Library after all. It might just have been a User error that could've been solved by better documentation or error messages. I will provide more Information and a sample project first thing monday. |
Here's a summary of the changes I made in order to get this to work.
The weird thing is that without a reference type as a public field, I don't have to embed the interop types and can instantiate the class directly. minimal Repro: The Repro contains 2 C# and one VB6 Project. The Solution contains 2 C# Winforms Projects targeting .NET 5. The only difference between the 2 Projects is that one has |
/cc @elinor-fung |
Alright - finally got to digging through this. @BickelLukas - thank you for the clear repro including the compiled VB6 binary - it was really helpful. The actual error is on inspecting the And indeed, the method is:
Whereas when it is embedded:
When running It is using the By default, <PropertyGroup>
<ComReferenceExecuteAsTool>true</ComReferenceExecuteAsTool>
</PropertyGroup> Which will launch In .NET Framework, the validation that is failing here was not done for We should be able to go back to skipping that validation for |
Description
I am using a VB6 Library through COM Interop.
Everything works fine until the class contains a reference type as a public field.
This causes the program to throw a
System.TypeLoadException: 'The Signature is incorrect'
as soon it is launched.VB6 Code:
as soon as the class containing that line gets used within the project it crashes.
Configuration
.NET Version: 5.0.102
OS: Windows 10 19042.746
Architecture: x64 (but app is built for x86 for Com interop)
Regression?
The same library can be used from .NET Framework without a Problem.
The text was updated successfully, but these errors were encountered: