0

I am on Fody 2.3.15 with Nullguard 1.6.3. The build environment uses MS Build 15.0. The devops build task was working fine in the past but now the build log files show the following error to which I get no clues. Can someone let me know what I am missing out here?

   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018: The "Fody.WeavingTask" task failed unexpectedly.
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018: System.TypeInitializationException: The type initializer for 'ContainsTypeChecker' threw an exception.
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:  ---> System.MissingMethodException: Method not found: 'Void System.AppDomainSetup.set_ApplicationBase(System.String)'.
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    at ContainsTypeChecker..cctor()
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    --- End of inner exception stack trace ---
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    at ContainsTypeChecker..ctor()
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    at Processor..ctor()
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    at Fody.WeavingTask.Execute()
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   C:\DropBoxBuild\packages\Fody.2.3.15\build\net452\Fody.targets(54,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Surprisingly my project solution still builds in VS 2017. So what can go wrong specifically with the build task. This is the command line action which triggers the build.

C:\Program Files\dotnet\dotnet.exe build C:\DropBoxBuild\DropBoxAgent.sln --no-restore

Migrating to the new version of Fody is not an option as it would mean a lot of rework in my devops. I did check the individual projects in the solution and they all use the same version of Fody and weaver.

Codecrasher99
  • 351
  • 3
  • 17

1 Answers1

0

i suspect that was fixed in 2.3.18 https://github.com/Fody/Fody/pull/455

However if you are unable to change your fody version, i suggest you use msbuild.exe to build instead of dotnet build.

Simon
  • 33,714
  • 21
  • 133
  • 202
  • I swtiched to Fody 4.2.1 but it still throws the same error – Codecrasher99 May 26 '20 at 14:18
  • @Codecrasher99 sorry to hear that. I think u have two approaches here. – Simon May 26 '20 at 22:39
  • @Codecrasher99 1. if u really cant update things. continue using MSBuild 2. if u can update things then move to the current stable release of Fody. if the issue still persists raise an issue on github https://github.com/Fody/Fody/issues/new?template=bug_report.md make sure u follow the issue template i guess a 3rd option, if you really want an old version patched, is i can quote u an hourly rate to fix it – Simon May 26 '20 at 22:41
  • As suggested I migrated to the latest version of Fody (6.1.2), Nullguard (2.2.0) and Equals (4.0.1). I also switched to .NET cli but I still run into build issues. This times its with the Equals addin which throws the exception Fody: Type SerializerRegistryKey marked with the |[Equals|] attribute does not contain op_Equality. Fix this by adding a method `public static bool operator ==(T left, T right) => Operator.Weave(left, right);` or, if you don|'t want the operator to be woven: set `|[Equals|].DoNotAddEqualityOperators = true`.|n|n|n – Codecrasher99 May 27 '20 at 07:44
  • sounds like it is time to raise some github issues – Simon May 28 '20 at 06:11