-
Notifications
You must be signed in to change notification settings - Fork 790
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
IL generation is no longer deterministic #15048
Comments
I'm seeing this in Ubuntu as well: |
@nojaf , I will take a look. |
Thank you, let me know if there is anything I can do! |
It didn't actually occur to me that we do parallel ilxgen, so they get accumulated in different orders. |
@nojaf, I believe the reason this occurs is because we emit the generated classes in the order the keys are accumulated in the concurrentdictionary. The fix will be to sort them in fullname order, before emitting them. |
@yES, here we go, 3rd time it changed the order ..:
|
Okay, I have a fix for your issue, but I also see this:
|
Thanks for this investigation @KevinRansom!
|
Hello @KevinRansom,
After #14941, some IL seems to get embedded (
g.TryEmbedILType
) (at least fornetstandard2.0
).The inserted location of
.class private auto ansi beforefieldinit System.Runtime.CompilerServices.IsReadOnlyAttribute
and.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute
does not appear to be deterministic..
I believe this happens when in
IlxGen.fs
,GetReadOnlyAttribute
andGetDynamicallyAccessedMemberTypes
are called. They invokecenv.g.TryEmbedILType
which adds these new types.Repro steps
Compile Fantomas.Core.fsproj using a local compiler. Do this multiple times
Note that this is a problem regardless of
--test:GraphBasedChecking
being active.Decompiling using ILdasm seems to indicate the difference.
Fantomas.Core-01.txt
Fantomas.Core-02.txt
Fantomas.Core.args.txt
Expected behaviour
if
is expected to be embedded, that is fine. I don't really know the full details of this.
But it should be embedded as the first or last thing I guess. In some predicate way.
Actual behaviour
It can really jump around for me locally. Sometimes both attributes are mixed, sometimes only one of the two.
Known workarounds
None so far.
Related information
When I tried locally to force the call to
g.TryEmbedILType
by callingsooner (in the constructor of
IlxAssemblyGenerator
) that didn't seem to have any effect.The text was updated successfully, but these errors were encountered: