danielpalme / IocPerformance

Performance comparison of .NET IoC containers
https://danielpalme.github.io/IocPerformance
Apache License 2.0
874 stars 157 forks source link

can't compile with vs2019 #111

Closed JonasSamuelsson closed 5 years ago

JonasSamuelsson commented 5 years ago

I just tried to comile with vs2019 and got the following error

Fody: PEVerify of the assembly failed.
[IL]: Error: [C:\dev\GitHub\IocPerformance\IocPerformance\bin\Debug\IocPerformance.exe : DryIocZero.Request::ToString][offset 0x0000002B] Cannot change initonly field outside its .ctor.(Error: 0x80131884)

seems to be related to your code @dadhi, can you have a look?

danielpalme commented 5 years ago

I had the same problem yesterday. Cleaning the bin and obj directories and restarting VS2019 did the trick.

See #106.

JonasSamuelsson commented 5 years ago

I've tried that, on two different machines, but still can't compile. Works just fine with vs2017 on the same machine.

danielpalme commented 5 years ago

Sometimes it helps to Build -> Rebuild -> Build. The problem is caused by https://github.com/dadhi/DryIoc which uses Fody

AArnott commented 5 years ago

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.

Barsonax commented 5 years ago

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.

danielpalme commented 5 years ago

I just removed DryIocZero and Cauldron (both are using Fody). Build should now work faster and reliably.