-
-
Notifications
You must be signed in to change notification settings - Fork 987
Basic support of InProcessNoEmitRunner
for NativeAOT.
#2702
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
Conversation
See #2701. |
Does it also fix |
src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs
Show resolved
Hide resolved
Co-authored-by: Tim Cassell <[email protected]>
It doesn't fix |
For the general return type to work we may expose a generic helper class for users to declare themselves the dependencies with. Not zero-instrumentation, but may be acceptable. |
That sounds like a better option. I don't want to special case a bunch of types. |
On second thought, I don't really want to add complex APIs just for this toolchain. The ultimate solution will be #1770. Tests are failing, please check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eliphatfs
If you were okay harcoding assembly name into Type.GetType with a constant string gets fully analyzed and produces no trimming warnings.
|
(The intrinsic APIs are doc'd at https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/intrinsic-requiresunreferencedcode-apis) |
Hi Michal, thank you for the valuable insights and comments! Are there any way through these intrinsics we may also solve the missing metadata error from MakeGeneric |
There are certain patterns where If it involved valuetypes, this can only be safe if analysis can see all possible instantiations ahead of time. So You'd need a source generator that generates the |
But just personally, as someone who has been using C# for many years yet not super familiar with dotnet runtime, I think using |
I also agree using a source generator is the ultimate solution, just as Tim has mentioned above. |
These are documented behaviors (documented on learn.microsoft.com on the pages I linked to) and as such are contractual, same way as e.g. If benchmark.net means AOT support seriously, eventually it will enable the trimming/AOT analyzers and then the Assembly.GetType use would immediately get flagged as a warning. Rewriting it to use |
Supports benchmark methods with
void
orTask
as return type.