Allow -main argument to override TLS entry point #9544
Replies: 1 comment 6 replies
-
Allowing I was also thinking about a compiler-only solution via a feature flag like |
Beta Was this translation helpful? Give feedback.
-
Allowing I was also thinking about a compiler-only solution via a feature flag like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is interest for BenchmarkDotNet to support the new
dotnet run app.cs
feature in .Net 10. dotnet/BenchmarkDotNet#2754Currently, BenchmarkDotNet generates a separate project with a generated entry point. But it won't work with
app.cs
files, because we can't use<ProjectReference>
on them, and we can't simply<Compile Include="app.cs">
either, because of all the new # directives (and still the TLS issue).The best way to do it is using Roslyn Source Generators. However, the problem is we can't generate an entry point if top-level statements are used, because the compiler does not allow -main argument. TLS are much more likely to be used in the new dotnet feature.
So what we need is for the already existing -main compiler argument to simply let us use it to override TLS.
I don't know what was the motivation to block it when TLS was introduced.
Beta Was this translation helpful? Give feedback.
All reactions