question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The "Fody.WeavingTask" task failed unexpectedly: The type initializer for 'ContainsTypeChecker' threw an exception

See original GitHub issue

Hello, Simon

I’ve got today very similar exception to this one (https://github.com/Fody/Fody/issues/87) trying to build Virtuosity project (I should say that I get the same error for all Fody projects):

Error   2   The "Fody.WeavingTask" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'ContainsTypeChecker' threw an exception. ---> System.NotSupportedException: '#' character in path is not supported while building projects containing Fody.
   at AssemblyLocation.CurrentDirectory() in c:\TeamCity\buildAgent\work\7495521761d392b9\Fody\AssemblyLocation.cs:line 13
   at ContainsTypeChecker..cctor() in c:\TeamCity\buildAgent\work\7495521761d392b9\Fody\ContainsTypeChecker.cs:line 9
   --- End of inner exception stack trace ---
   at ContainsTypeChecker..ctor()
   at Processor..ctor() in c:\TeamCity\buildAgent\work\7495521761d392b9\Fody\Processor.cs:line 28
   at Fody.WeavingTask.Execute() in c:\TeamCity\buildAgent\work\7495521761d392b9\Fody\WeavingTask.cs:line 44
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() Fody

I didn’t get a hint from #87 how to resolve an issue, therefore I would be very grateful to you for your help.

Thank you in advance.

Regards, Dmitry

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
canton7commented, Oct 5, 2015

Yep, I was trying to be nice, heh. The .NET error doesn’t make it obvious what the problem is, so thought I’d share in case anyone else was googling and hit this issue.

2reactions
canton7commented, Oct 5, 2015

For anyone else stumbling on this, I had a similar issue:

Error           The "Fody.WeavingTask" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'ContainsTypeChecker' threw an exception.
---> System.IO.FileLoadException: Could not load file or assembly 'file:///<path>\packages\Fody.1.29.2
FodyIsolated.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 
x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a
network location which would have caused the assembly to be sandboxed in previous versions of the
.NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this
load may be dangerous. If this load is not intended to sandbox the assembly, please enable the
loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more
information.

The solution is to right-click the dll in question, and check the ‘Unblock’ checkmark.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fody.WeavingTask task fails unexpectedly with System. ...
The devops build task was working fine in the past but now the build log files show the following error to which I...
Read more >
Ncrunch Fody ContainsTypeChecker - Build/Test Issues
WeavingTask " task failed unexpectedly. System.TypeInitializationException: The type initializer for 'ContainsTypeChecker' threw an exception.
Read more >
Severity Code Description Project File Line Suppression ...
Error The "Fody.WeavingTask" task failed unexpectedly. System. ... The type initializer for 'ContainsTypeChecker' threw an exception.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found