-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
C# application referencing /clr:netcore creating its own static instances #64905
Comments
Tagging subscribers to this area: @dotnet/area-meta Issue DetailsI have a WPF net5.0-windows C# application that references a /clr:netcore targeted Managed C++ library. The C# application instantiates a static instance of a core system. When the Managed C++ accesses that instance, instead of seeing it already exists, it creates its own. Any usage of it goes through "native" handles and crashes when it accesses code that isn't available to /clr:netcore (example: Microsoft.Data.SqlClient). What can be done to stop this behavior, or is this new and intended as of /clr:netcore?
|
@fiercekittenz This is known issue with C++/CLI and how it works in .NET Core 3.1/.NET 5+. WPF is particularly sensitive to this issue and is described at dotnet/wpf#1700. @vitek-karas and @elinor-fung This seems like another manifestation of the single ALC issue we've been tracking. Is there a specific issue we are using in the runtime? |
/cc @agocke |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsI have a WPF net5.0-windows C# application that references a /clr:netcore targeted Managed C++ library. The C# application instantiates a static instance of a core system. When the Managed C++ accesses that instance, instead of seeing it already exists, it creates its own. Any usage of it goes through "native" handles and crashes when it accesses code that isn't available to /clr:netcore (example: Microsoft.Data.SqlClient). What can be done to stop this behavior, or is this new and intended as of /clr:netcore?
|
I believe #61105 is tracking this general problem. |
Also related: #62754 |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsI have a WPF net5.0-windows C# application that references a /clr:netcore targeted Managed C++ library. The C# application instantiates a static instance of a core system. When the Managed C++ accesses that instance, instead of seeing it already exists, it creates its own. Any usage of it goes through "native" handles and crashes when it accesses code that isn't available to /clr:netcore (example: Microsoft.Data.SqlClient). What can be done to stop this behavior, or is this new and intended as of /clr:netcore?
|
Thanks. I did stumble upon that yesterday through some clever web searches. It should be documented somewhere though. I blew 2 days of engineering time trying to figure out what was going on until I fumbled into the other issue thread. |
Closing based on #66486 - C++/CLI DLLs targeting .NET 7 will be loaded into the default Documentation was added in dotnet/docs#28850 |
I have a WPF net5.0-windows C# application that references a /clr:netcore targeted Managed C++ library. The C# application instantiates a static instance of a core system. When the Managed C++ accesses that instance, instead of seeing it already exists, it creates its own. Any usage of it goes through "native" handles and crashes when it accesses code that isn't available to /clr:netcore (example: Microsoft.Data.SqlClient).
What can be done to stop this behavior, or is this new and intended as of /clr:netcore?
The text was updated successfully, but these errors were encountered: