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

Native AOT compatibility #99

Open
EvanMulawski opened this issue Dec 15, 2023 · 5 comments
Open

Native AOT compatibility #99

EvanMulawski opened this issue Dec 15, 2023 · 5 comments

Comments

@EvanMulawski
Copy link

EvanMulawski commented Dec 15, 2023

In a .NET 8 app with Native AOT enabled (<PublishAot>true</PublishAot>), I'm getting an exception when attempting to parse:

System.InvalidProgramException: Common Language Runtime detected an invalid program.
         at Thunk1ret_MyType_TextFindHelper&(Func`2, TextFindHelper&)
         at RecordParser.Parsers.VariableLengthReader`1.Parse(ReadOnlySpan`1 line)

where MyType is the tuple/class/record/struct type name.

Version: 2.3.0

@leandromoh
Copy link
Owner

leandromoh commented Dec 19, 2023

Hi @EvanMulawski

I made a few tests with expression tree in console application and got the same error.

image

seems the problems only happens if the parameter of the function is a ReadOnlySpan<char> AND if building using dotnet 8. If I change any of these things (replace span by string or building using dotnet 7) everything work as expected.

to help me investigate, could you please check if your code works when building using dotnet 7 ?

@EvanMulawski
Copy link
Author

Hi @leandromoh, changing the target framework to .NET 7 with no other changes results in the parsing working as expected.

This looks like a regression in AOT compilation in .NET 8. Might want to open an issue in dotnet/runtime.

@leandromoh
Copy link
Owner

Opened: dotnet/runtime#96160

@Esperadoce
Copy link

Same problem here

@leandromoh
Copy link
Owner

hello @Esperadoce, for now, RecordParse does not support Native AOT because of the mentioned dotnet issue. in the coversation looks like they dont plan to fix the issue, so probably we will only support AOT using source-generators, which is not in the plans for now.

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

3 participants