Closed JonasSamuelsson closed 5 years ago
I had the same problem yesterday. Cleaning the bin and obj directories and restarting VS2019 did the trick.
See #106.
I've tried that, on two different machines, but still can't compile. Works just fine with vs2017 on the same machine.
Sometimes it helps to Build -> Rebuild -> Build. The problem is caused by https://github.com/dadhi/DryIoc which uses Fody
When I checkout master from this repo, it won't build:
1> Fody: Verifying assembly
1>MSBUILD : error : Fody: PEVerify of the assembly failed.
1>MSBUILD : error : [IL]: Error: [C:\Users\andarno\Source\Repos\IocPerformance\IocPerformance\bin\Debug\IocPerformance.exe : DryIocZero.Request::ToString][offset 0x0000002B] Cannot change initonly field outside its .ctor.(Error: 0x80131884)
1>MSBUILD : error : 1 Error(s) Verifying C:\Users\andarno\Source\Repos\IocPerformance\IocPerformance\bin\Debug\IocPerformance.exe
1> Fody: Finished verification in 3244ms.
Also, compile is danged slow. If this is all fody's fault, I think that should be called out when reporting metrics on various containers (e.g. " ❗️ this uses fody, and dramatically slows down your build")
The workaround to "build, rebuild, build" is no workaround. It's just that fody's buggy code gen and verification step don't run after an otherwise successful build, so the verification is skipped. Every time I meet a project that uses fody, I run screaming asap.
Might actually be better to remove it completely in my opinion. It takes ages to build.
Seriously nobody will use a container that makes your compile that slow. If they do then that is a mistake and they should switch to a different container.
I just removed DryIocZero and Cauldron (both are using Fody). Build should now work faster and reliably.
I just tried to comile with vs2019 and got the following error
seems to be related to your code @dadhi, can you have a look?