I have some code for C# web service(WCF) and use puppeteer-sharp library. First of all, page should be created and related method located below named SayfaOlustur(). However I faced System.IO.FileLoadException exception line LaunchOptions.
This code worked on my local machine and TestProject(used TestMethods in TestClass) but after publishing whole code page did not created and throw System.IO.FileLoadException and System.Value exception.
System.Value.dll included in project reference and bin folder.
public static async Task<Page> SayfaOlusturAsync()
{
Browser browser = null;
try
{
var filePath = ConfigurationManager.AppSettings["PuppeterSharpBrowserFetcherLocalChromium"].ToString();
var browserFetcher = new BrowserFetcher(new BrowserFetcherOptions
{
Path = string.IsNullOrEmpty(filePath) ? @"C:\PuppeteerSharpLocalChromium" : filePath
});
await browserFetcher.DownloadAsync(BrowserFetcher.DefaultRevision);
var options = new LaunchOptions
{
Headless = true,
ExecutablePath = @"C:\PuppeteerSharpLocalChromium\Win64-674921\chrome-win\chrome.exe"
};
browser = await Puppeteer.LaunchAsync(options);
}
catch (Exception ex)
{
HelperUtils.CmsLogger.Error(ex, "SayfaOlusturAsync");
}
return await browser.NewPageAsync();
}
Expected result is created a page with Chronumium
Exception details
System.IO.FileLoadException: 'Could not load file or assembly "System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" or one of its dependencies.