Skip to content
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

Possible MissingMethodException caused by System.ValueTuple #1118

Closed
alsami opened this issue May 10, 2020 · 6 comments
Closed

Possible MissingMethodException caused by System.ValueTuple #1118

alsami opened this issue May 10, 2020 · 6 comments

Comments

@alsami
Copy link
Member

alsami commented May 10, 2020

As discussed here using System.ValueTuple requires the package System.ValueTuple to be referenced when targeting net461

As @alistairjevans stated in the discussion linked above, we are already using it and not getting any compiler errors (which should not be the case for net461).

Here also an issue on the roslyn repository that states, that this missing include was added with net471.

Easiest and safest fix would be to have a conditional package-reference

<PackageReference Condition="$(TargetFramework) == 'net461'" Include="System.ValueTuple" Version="4.5.0"  />

That does not explain why there is no compiler error though.

@alistairjevans
Copy link
Member

Are you able to recreate this locally @alsami, and get a MissingMethodException?

@alsami
Copy link
Member Author

alsami commented May 10, 2020

Are you able to recreate this locally @alsami, and get a MissingMethodException?

@alistairjevans will get a sample repo ready later today.

@alsami
Copy link
Member Author

alsami commented May 10, 2020

So I just looked into it a bit and interestingly there is no way to make it throw an error. I double checked if that problem in general does exist and created a small repository that already fails to compile without the uncommented package-reference in the csproj file.

I then thought it must be somewhat included through some dependency that we have on net461 but didn't find it for Microsoft.Bcl.AsyncInterfaces or for System.ComponentModel.Composition.

@alistairjevans
Copy link
Member

Perhaps it's the netstandard2.0 reference?

Or something to do with this comment in the issue you linked?

@alsami
Copy link
Member Author

alsami commented May 10, 2020

Perhaps it's the netstandard2.0 reference?

Or something to do with this comment in the issue you linked?

I figured it out now. If you uncomment the reference to Microsoft.Bcl.AsyncInterfaces in the Autofac project, it fails to compile on net461 in the sample that uses value-tuples.

Not sure why though, I can't find it as a dependency of the package, not even in the peer dependency of that said package. Closing this, sorry for the confusion! :)

@alsami alsami closed this as completed May 10, 2020
@alistairjevans
Copy link
Member

No probs, good to get to the bottom of stuff like this.

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

No branches or pull requests

2 participants