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.

Issue with Fody 2.3.0+ in VB assemblies

See original GitHub issue

I found the following error when trying to upgrade one of our VB projects to use the latest version of Fody:

Error		Fody: An unhandled exception occurred:
Exception:
Failed to execute weaver C:\Users\jwoods\.nuget\packages\janitor.fody\1.6.1\netclassicweaver\Janitor.Fody.dll
Type:
System.Exception
StackTrace:
   at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 208
   at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 103
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
Object reference not set to an instance of an object.
Type:
System.NullReferenceException
StackTrace:
   at CecilExtensions.Find(TypeDefinition typeReference, String name, String[] paramTypes) in C:\projects\janitor\Janitor.Fody\CecilExtensions.cs:line 110
   at ModuleWeaver.FindCoreReferences() in C:\projects\janitor\Janitor.Fody\ReferenceFinder.cs:line 7
   at ModuleWeaver.Execute() in C:\projects\janitor\Janitor.Fody\ModuleWeaver.cs:line 9
   at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 204
Source:
Janitor.Fody
TargetSite:
Mono.Cecil.MethodDefinition Find(Mono.Cecil.TypeDefinition, System.String, System.String[])

At first, I thought this was an issue with the Janitor weaver, but after trying to make a failing unit test in the Janitor project, I found that it ran correctly in the unit test.

Then I also noticed a similar error upgrading another VB project to use the latest version of Anotar.

I did a little digging and found that Janitor 1.5.2 works correctly with Fody 2.2.1, but if I just upgrade Fody to 2.3.0, I start getting this error. I also upgraded both Janitor and Fody to the latest versions available (1.6.1 & 3.0.4, respectively) and still get the error (I’ve created a repo to show this error).

This error only occurs when running Fody on a VB assembly using the full .Net Framework.

Here are the test cases I used:

Language Framework Result
C# netstandard2.0 no error
C# net462 no error
VB netstandard2.0 no error
VB net462 ERROR

After looking into the issue a bit, I found that on line 7 (from the Janitor weaver) the code ModuleDefinition.TypeSystem.Object.Resolve() returns null when running using Fody (again, it worked from the unit test, so that seems to indicate the error is not in Mono.Cecil).

My suspicion is that the error is somewhere in the Fody.Isolated project. I’ve been trying to write a unit test to confirm my suspicion, but I have been having trouble doing that.

I just wanted to go ahead and raise this issue up here as you may have more success at adding a failing unit test than I’m currently having.

I’ll update this issue if I find any further details.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
jasonwoods-7commented, Jun 25, 2018

adding <Reference Include="mscorlib" /> fixes the issue. weird that that’s not automatically included in VB projects.

0reactions
jasonwoods-7commented, Jun 25, 2018

yes, it can be closed

Read more comments on GitHub >

github_iconTop Results From Across the Web

After updating Fody from 2.0.0 (sample solution) to 2.3.1, ...
Update from 2.0.0 to 2.3.1 in Fody, causes VS2015 to not build the assembly with debug information, meaning it's impossible to put a...
Read more >
Could not load assembly 'Telerik.XamarinForms.SkiaSharp
Hi All, I have installed a licensed version of Telerik.XamarinFroms.UI and can`t build my project.
Read more >
MsgReader 5.2.4
It supports all body types there are in MSG files, this includes: Text; HTML; HTML embedded into RTF; RTF. MSGReader has only a...
Read more >
Troubleshooting Interoperability - Visual Basic
This situation is common when a new version of an assembly is installed and another application is still using the old version of...
Read more >
The genome of the yellow potato cyst nematode, Globodera ...
We generate a high quality genome assembly for G. rostochiensis pathotype Ro1, ... Cysts, formed from the body wall of the adult female,...
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