Click here to Skip to main content
15,946,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

Source Error:


Line 73:         string dir = Server.MapPath("~/app/surveyor/");
Line 74:         // save resulting pdf into file
Line 75:         pdf.SaveAs(Path.Combine(dir, "ChromePdfRenderer.Pdf"));
Line 76:     }
Line 77: }

Source File: d:\irshad_work\ship_inspection_original\admin\report.aspx.cs    Line: 75

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' could not be loaded.


What I have tried:

public void generate_pdf()
   {
       var ChromePdfRenderer = new ChromePdfRenderer();
       var html = @"<h1>Hello World!</h1><br><p>This is IronPdf.</p>";
       // turn html to pdf
        var pdf = ChromePdfRenderer.RenderHtmlAsPdf(html);
       string dir = Server.MapPath("~/app/surveyor/");
       // save resulting pdf into file
       pdf.SaveAs(Path.Combine(dir, "ChromePdfRenderer.Pdf"));
   }
Posted
Updated 29-May-23 4:05am
Comments
Andre Oosthuizen 29-May-23 7:58am    
The error message explains it in full - 'Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'. You need to check the path to the required file as it could not be found.

1 solution

Open the References node of your project in Solution Explorer. You should find "System.Memory" listed in there. If not, you can try getting it from Nuget. Go to Tools->Nuget Package Manager->Package Manager Console. Type "Install-Package System.Memory".

THIS MAY OR MAY NOT FIX YOUR PROBLEM. This might just fix one error, only to expose another one. The problem would be with the IronPdf library you're using. You have to follow whatever instructions there are for INSTALLING AND USING that library and not just set a reference to a loose .DLL you found.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900