Skip to content

Conversation

@edyoung
Copy link
Collaborator

@edyoung edyoung commented Apr 27, 2019

GenerateMethodForDirectCall creates an IL wrapper for a method in the provider. It allows a function OnUnhandledException to be defined in the interface and implemented in the provide. The generated code calls OnUnhandledException if there is an exception. However the methodInfo for the OUE method is from the interface so needs to be called as a virtual method. It looks like .NET Core 3.0 tightens up IL validation and now throws a "Bad IL Format" exception for this, where in .NET Core 2.0 it let it slide.

1-line fix is to CallVirtual instead of Call.

I believe this is a latent bug in our code. We could still raise it with the CoreFx team I guess since it is a change in behavior that could break others (and servicing packagemanagement with this issue could be interesting, since we can't download the new version with a broken version. But we should fix in any case.

il.Emit(OpCodes.Ldstr, instanceMethod.ToSignatureString());
il.LoadLocation(exc.LocalIndex);
il.Call(onUnhandledException);
il.CallVirtual(onUnhandledException);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the actual fix - the rest is fixing a typo, Virutal instead of Virtual

@edyoung
Copy link
Collaborator Author

edyoung commented Apr 27, 2019

@edyoung edyoung merged commit 1fe22c3 into WIP Apr 30, 2019
@edyoung
Copy link
Collaborator Author

edyoung commented Apr 30, 2019 via email

@SteveL-MSFT
Copy link
Contributor

@edyoung yes, we pick up PackageManagement from PSGallery at build time, so it would be great if you can publish it there, then I can update the version we pick up manually in our 3.0 working branch. Just ping me once it's published. Our master branch will pick it up automatically, but not working branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants