When trying to generate a pdfHtml report in Xamarin.Forms using a .netStandard2 project, the exception System.ArgumentNullException: 'Value cannot be null. Prameter name: assembly
.
This is the code that is run:
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "Data.test.html";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
using (FileStream pdfDest = File.Open(targetPath, FileMode.Create))
{
string result = reader.ReadToEnd();
ConverterProperties converterProperties = new ConverterProperties();
HtmlConverter.ConvertToPdf(result, pdfDest, converterProperties);
}
The code works, when run in a .net6 console application.