Skip to content
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

Clang's crash recovery support breaks the .NET runtime's ability to throw NullReferenceException on Linux #7

Open
PathogenDavid opened this issue Mar 9, 2022 · 0 comments

Comments

@PathogenDavid
Copy link
Member

This was slowly driving me insane while debugging a test which tests shoving a null in a place where it doesn't belong.

Minimal repro:

ClangSharp.Pathogen.LibClangSharpResolver.VerifyResolverWasUsed();
object o = null!;
Console.WriteLine(o.GetHashCode());

You would expect o.GetHashCode to throw NullReferenceException, but on Linux this will throw SEHException instead.

As a workaround you can set LIBCLANG_DISABLE_CRASH_RECOVERY=1, which seems to indicate there's a conflict between Clang's crash recovery and .NET's internal handling of null dereferences.

The easiest workaround would be to use setenv before initializing libclang as suggested here: dotnet/ClangSharp#167 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant