-
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
Assembly::Load crashes C++/CLI app in try block with 9.0.0-rc.2.24473.5 #109242
Comments
@janvorli Anything above ring a bell? |
This is regression introduced by #99137. The crash is triggered by calling Assembly.Load in a method with stackalloc on Windows x64. Small C# repro: using System.Reflection;
m();
static void m()
{
unsafe
{
void* p = stackalloc byte[Random.Shared.Next(100)];
Console.WriteLine((IntPtr)p);
}
Assembly.Load("System.Runtime");
} |
LightUnwind does not track sufficient context to compute GS cookie address Fixes dotnet#109242
LightUnwind does not track sufficient context to compute GS cookie address Fixes dotnet#109242
LightUnwind does not track sufficient context to compute GS cookie address Fixes #109242
Thank you for reporting this issue! We expect that the fix will be included in January 2025 .NET 9 servicing update. If you need to work-around the issue in the meantime, it can be done by factoring out the Assembly.Load call into a separate non-inlineable method: using namespace System::Runtime::CompilerServices;
[MethodImpl(MethodImplOptions::NoInlining)]
__declspec(noinline)
static System::Reflection::Assembly^ AssemblyLoadWorkaround(System::String^ s)
{
return System::Reflection::Assembly::Load(s);
}
...
System::String^ s = "System";
System::Reflection::Assembly^ a = AssemblyLoadWorkaround(s);
Console::WriteLine(a->FullName);
... |
LightUnwind does not track sufficient context to compute GS cookie address Fixes dotnet#109242
LightUnwind does not track sufficient context to compute GS cookie address Fixes #109242 Co-authored-by: Jan Kotas <[email protected]>
Description
It's bizarre to say the least. Take this C++/CLI code:
Which I invoke from a plain C++ app:
Every time this crashes the application. If I pass
nullptr
instead of"System"
then the crash does not occur.Reproduction Steps
Here is a zip file. You'll have the change the line in
CppApp.cpp
to point to the correct DLL.CppCliApp.zip
The application will crash.
Expected behavior
No crash.
Actual behavior
Crash with stack trace:
With locals:
Regression?
No response
Known Workarounds
No response
Configuration
Runtime: 9.0.0-rc.2.24473.5
SDK: 9.0.100-rc.2.24474.11
MSBuild: MSBuild version 17.11.9+a69bbaaf5 for .NET Framework 17.11.9.46202
Other information
No response
The text was updated successfully, but these errors were encountered: