jspuij / Cortex.Net

State management like MobX for .NET and Blazor

Home Page:https://jspuij.github.io/Cortex.Net.Docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Error: Could not load file or assembly System.ValueTuple

AbdullahUlber opened this issue · comments

When building the Cortex.Net.BlazorTodo sample project from Jul 15, 2020 on VS 2019 (16.7.2) I get the build error below. The same build error appears for a new Blazor WebAssembly project when adding the Cortex.Net weaver to FodyWeavers.xml.

The error message suggests that Fody tries to find System.ValueTuple 4.0.3.0 or 4.0.0.0 while .NET Standard 2.1 includes System.ValueTuple 4.0.2.0.

Severity Code Description Project File Line Suppression State
Error Fody: An unhandled exception occurred:
Exception:
Failed to execute weaver C:\Users\abdullah.ulber\source\repos\Cortex.Net-master\src\Cortex.Net.Fody\bin\Debug\netstandard2.0\Cortex.Net.Fody.dll
Type:
System.Exception
StackTrace:
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 202
at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 109
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Type:
System.IO.FileNotFoundException
StackTrace:
at Cortex.Net.Fody.ReactiveObjectInterfaceWeaver..ctor(ModuleWeaver parentWeaver, WeavingContext weavingContext)
at Cortex.Net.Fody.ModuleWeaver.Execute()
at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 174
Source:
Cortex.Net.Fody
TargetSite:
Void .ctor(Cortex.Net.Fody.ModuleWeaver, Cortex.Net.Fody.WeavingContext)
Could not load file or assembly 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Type:
System.IO.FileNotFoundException
Cortex.Net.BlazorTodo 1

The error message has been been updated in the Fody package:

Failed to execute weaver {weaver.Config.AssemblyPath} due to a failure to load ValueTuple.
This is a known issue with in dotnet (https://github.com/dotnet/runtime/issues/27533).
The recommended work around is to avoid using ValueTuple inside a weaver.

I guess that this means that any code using this package should not try to use tuples that would be written to FodyWeavers.xml. I have played around with removing the tuple returned by TrackDerivedFunction and ComputeValue (i.e. removing the exceptions returned with the values) but it still is causing this error in the sample projects.

I've created a new version 0.4.0 which should appear on nuget shortly.