FastReport instantiation throws TypeInitializationException

Initially, I started with the opensource library, then having issues when moving to dotnet 8 on a docker instance due to System.Drawing being dropped in support. Searching for answers stumbled up on the the FastReport.Core.Skia.Demo library. It was nearly a direct drop replacement. I reached out to buying a license, and looking at the licenses it looked like the Avalonia license fits the bill. All I needed was the core library, I did not need anything else. Turns out, the FastReport.Core.Skia library is not a part of the Avalonia license. Anyway, this is fine so long as everything works.

I continue with the FastReport.Avalonia library and when I try to instantiate:

var report = new FastReport.Report();

I receive the following error:

System.TypeInitializationException : The type initializer for 'FastReport.Report' threw an exception.

----> System.NullReferenceException : Object reference not set to an instance of an object.

If I am not using Avalonia is this library even useful?

Thank you

Comments

  • Looks like I need to use Avalonia.Desktop. Not what I was looking to do, but after preparing Avalonia's environment I could call it.

    var avalonia = AppBuilder.Configure<Application>()

    .UsePlatformDetect();

    avalonia.SetupWithoutStarting();

    var report = new FastReport.Report();

Leave a Comment