I have a test in C# that looks like this:
public void CanLog()
{
ModUnderTest.Log.Info("HI");
}
This C# code throws a Null Reference exception saying that ModUnderTest.Log is null in the test. Here is the code under test:
module ModUnderTest
let Log = log4net.LogManager.GetLogger("name")
Why does this not work? It compiles fine but fails at runtime.
My guess is either (1)
GetLoggeris returning null (you have the wrong ‘name’), or (2) the F# code is in an EXE rather than a DLL, and the static initializer for the module is not being run.