-
-
Notifications
You must be signed in to change notification settings - Fork 399
Code change for PublishAot compliance #692
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
base: master
Are you sure you want to change the base?
Conversation
I did a bit of the archeology and it looks like we do indeed only support Unity 2019 LTS+ since switching to the package format, because everything before that doesn't support the modern incarnation of the package format. Is any of this still valuable without "DynamicallyAccessedMembers" ? Seems like we could get the Marshal changes in pretty easily; then at least your fork is more similar to upstream as we figure out what to do about DynamicallyAccessedMembers. |
It would prevent a proper usage of Functionally speaking, nothing will break when using We could very well just |
D.A.M. attribute probably not a problem to Unity user. Once it's guarded under |
I need to update this PR. I intend to just remove The other warnings can be ignored, and if someone complains about those warnings, they can be silenced to get a clean output. |
DynamicallyAccessedMembers is used to tell tools which member should reserved during AOT and trimming. In our case, apply DynamicallyAccessedMemberTypes.PublicFields and DynamicallyAccessedMemberTypes.PublicProperties is enough I think.
…---Original---
From: "Thomas ***@***.***>
Date: Fri, May 30, 2025 15:23 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [rlabrecque/Steamworks.NET] Code change for PublishAot compliance(PR #692)
ThomasFOG left a comment (rlabrecque/Steamworks.NET#692)
I need to update this PR. I intend to just remove DynamicallyAccessedMembers. This attribute doesn't do what I think it does (and I mostly still don't know what it actually does). I believe that Steamworks.NET will be as robust as it can get with just the marshalling changed to generics.
The other warnings can be ignored, and if someone complains about those warnings, they can be silenced to get a clean output.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
That's what I thought it was doing, but working on another project where we added the attribute showed that it does absolutely not that and would still trim those types. |
This is a working copy to discuss #686
For now it has the functional changes required for the
PublishAot
compliance and fixes the IL warnings.To be discussed:
Marshal.SizeOf<T>()
andMarshal.PtrToStructure<T>(IntPtr ptr)
both require .NET 4.5.1 (netstandard 1.2)DynamicallyAccessedMembers
requires .NET 5, and is not part of netstandard (which is not used by modern .NET platforms anymore)For the standalone version, it is likely safe to switch the
TargetFramework
tonet5.0
. It wouldn't change much of the current nuget coverage. It would remove support for pre-net6 mono/Xamarin (which are irrelevant since they are mobile targets), and the non-mobile targets would remain the same. Then it would be possible to add<IsAotCompatible>true</IsAotCompatible>
.For the Unity version, the marshalling methods would require Unity 5.6 (aka 2017.0), which seems fine since the Unity package targets 2019.4, but
DynamicallyAccessedMembers
will be a problem no matter which targeted Unity version because modern .NET 5+ is not supported at all. In this specific case it seems reasonable to have preprocessing switches around it.For the old-school .NET 4.0 .csproj, if it desired to keep having it around (as I understand, it is there for users willing to compile an old-school lib from source, and it is not distributed in the nuget nor on the pre-built releases, right?), then preprocessing or proxy types would be required to keep it running.