Closed hypeartist closed 4 years ago
Yes, it's definitely possible, I'm using it just fine in netcoreapp3.1 projects.
This looks like an issue with the loaded assemblies in MSBuild itself. InlineIL uses a ValueTuple
in TypeRefBuilder.AddModifiers
, but it expects a different version of the library than the one which is loaded. Some other assembly used by MSBuild (probably another custom task) must have loaded a previous version of System.ValueTuple
, which causes the error you see.
Could you provide a repro project so that I can take a look? Also, are you building with msbuild or dotnet build, and what version do you have? I suppose I could remove usages of System.ValueTuple
from InlineIL but I'd rather not, since it's convenient.
Could you provide a repro project so that I can take a look?
Sure: Test
Thanks. I built it on 2 different machines using both dotnet build and MSBuild, and it built fine.
I noticed you have set <LangVersion>preview</LangVersion>
, are you using a preview dotnet SDK?
I've seen a tweet from @simoncropp saying he has issues with ValueTuple
after installing a VS preview, so I guess this is related.
Maybe I should remove ValueTuple
usages from InlineIL anyway because of this mess.
are you using a preview dotnet SDK?
Yes, I use Visual Studio 19 Preview
which comes bundled with its .NET Core 3.1 Preview
. I am also targeting .NET 5.0 Preview
.
Maybe I should remove
ValueTuple
usages from InlineIL anyway because of this mess.
Oh! That would be just great of you!
I have downloaded and installed the latest .NET Core 3.1 LTS
(3.1.105) and add global.json
to the project folder:
{
"sdk": {
"version": "3.1.105"
}
}
But it didn't help much. Still getting the very same error.
Wait, I don't think 3.1.105 is a correct version number. The latest is 3.1.301 (see what dotnet --info
tells you).
You may also try adding -nr:false
to the dotnet build
command, to see if it helps as a workaround.
Wait, I don't think 3.1.105 is a correct version number. The latest is 3.1.301.
Hmm... https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.105-windows-x64-installer
You may also try adding
-nr:false
to thedotnet build
command, to see if it helps as a workaround.
Well, -nr:false
have worked fine on CLI. But how can I use it inside VS?
Oh, OK sorry I haven't noticed that version, it's apparently for an older VS version.
I don't think you can easily set -nr:false
from VS itself, but you can try to run VS with the MSBUILDDISABLENODEREUSE=1
environment variable.
but you can try to run VS with the
MSBUILDDISABLENODEREUSE=1
environment variable.
From here:
This features (for various reasons) is not supported in the .NET Core version of MSBuild
But I did give it a try anyway and it really doesn't work
Ok, well I guess you'll have to wait for me to release an updated InlineIL version then 😕
I'll try to do that later today.
I released v1.4.2 which removes the dependency on System.ValueTuple
, it turns out there was a single usage.
It should be available on NuGet in a few minutes.
Works like a charm now! Thank you so much for such great responsiveness!
Sorry. i should have scanned other repos for this.
No worries, your tweet helped enough 😉
FYI, I wrote a unit test which checks if a value tuple is used anywhere in an assembly, in case you may be interested. Value tuples aren't exactly easy to spot with a text search...
@ltrzesniewski perhaps a catch in fody core that checks the exception message and says "just dont use them"?
I don't think that's worth the trouble. I hope that if a user sees an "unexpected error" message he'll submit an issue like @hypeartist has done here.
I mainly added the unit test to avoid the problem reappearing in the future.
fair enough :)
Is it possible to use InlineIL.Fody in .NET Core 3.1 (or higher)? I get some weird error regarding
System.ValueTuple
not being found.