0

I'm trying to downgrade log4net from 2.0.8 to 2.0.0 on my project because I am trying to reference a project with version 2.0.0, which I need to do because Apache changed the public key between these versions.

My problem is after downgrading when I try and run my project I get the following error:

An unhandled exception of type 'System.TypeInitializationException' occurred 
in Unknown Module.
The type initializer for '<Module>' threw an exception. occurred

There isn't an inner exception I can look at as the error occurs before any code is even hit.

If I upgrade log4net back to 2.0.8 the error stops happening.

I've tried this solution but had no luck.

NigelMassey
  • 305
  • 1
  • 2
  • 10

1 Answers1

0

While I was writing this question I managed to work out what was wrong.

Version 2.0.8 of log4net adds the below 'dependentAssembly' to your projects app.config file and upon downgrading it does not get removed.

Deleting it from the app.config solved my issue.

  <dependentAssembly>
    <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
  </dependentAssembly>

Hope this helps someone else.

NigelMassey
  • 305
  • 1
  • 2
  • 10