-
Notifications
You must be signed in to change notification settings - Fork 12
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
AreAllMembersBlittable throws TypeLoadException in NativeAOT #51
Comments
hi, It tried to reproduce the exception without success in a small test. Did you register the aot.RegisterComponent<Health>(); as mentioned at Examples - General > Native AOT? edit: Ah, you did. |
Yes. public struct Health : IComponent, IComponentData
{
public int Hp;
public int MaxHp;
private int _status;
public StatusEffect Status
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (StatusEffect)_status;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set => _status = (int)value;
}
} |
I assume you are using .NET 8? |
According to this post: Can you try adding the attribute I assume |
Used, of course. And DynamicallyAccessedMembers didn't help. I can try to make a reproducible project, but it will take time. |
That would be very helpful! The workaround using a property - like |
I've tried to find the problem, but it's not in the framework. BenchmarkDotNet doesn't compile the NativeAOT build correctly if you run benchmarks selectively. The problem is definitely a floating issue. |
Another question came up. Should we create an open issue? I'm not comfortable adding the IComponent/ITag interface to all components and tags in my tests. I tried to bypass the system as follows: public struct Comp<T>(T v) : IComponent
{
public T V = v;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Comp<T>(in T value) =>
new() { V = value };
}
public struct Tag<T> : ITag
{
public T Value;
} But it wasn't good.
The problem doesn't involve NativeAot. Friflo.Engine.ECS.AssemblyLoader.GetComponentTypes doesn't bypass generic types. It can't be done automatically, but maybe I can add types manually? |
Thx for reporting this. |
If a registered component has an enum, AreAllMembersBlittable throws a TypeLoadException in NativeAOT.
The text was updated successfully, but these errors were encountered: