Closed dahovey closed 1 year ago
Any news on this?
I have a similar issue.
msbuild
fails for BaseFont.GetResourceStream(string)
.
This is not BaseFont.CreateFont()
so maybe it's off-topic.
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : Type 'System.Runtime.Loader.AssemblyLoadContext' from assembly 'mscorlib' was not included in compilation, but was referenced in method 'BaseFont.GetResourceStream(string)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\BookViewerApp3\BookViewerApp3\BookViewerApp\BookViewerApp\BookViewerApp.csproj]
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : Type 'System.Runtime.Loader.AssemblyLoadContext' from assembly 'mscorlib' was not included in compilation, but was referenced in method 'BaseFont.GetResourceStream(string)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\BookViewerApp3\BookViewerApp3\BookViewerApp\BookViewerApp\BookViewerApp.csproj]
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : Method 'BaseFont.GetResourceStream(string)' will always throw an exception due to the missing method 'AssemblyLoadContext.get_Default()' in assembly 'System.Runtime.Loader'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\BookViewerApp3\BookViewerApp3\BookViewerApp\BookViewerApp\BookViewerApp.csproj]
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : Method 'BaseFont.GetResourceStream(string)' will always throw an exception due to the missing method 'AssemblyLoadContext.get_Default()' in assembly 'System.Runtime.Loader'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\BookViewerApp3\BookViewerApp3\BookViewerApp\BookViewerApp\BookViewerApp.csproj]
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x86.microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\x86\ilc\Tools64\nutc_driver.exe @"D:\a\BookViewerApp3\BookViewerApp3\BookViewerApp\BookViewerApp\obj\x86\Release\ilc\intermediate\MDIL\BookViewerApp.rsp"' returned exit code -1073740791 [D:\a\BookViewerApp3\BookViewerApp3\BookViewerApp\BookViewerApp\BookViewerApp.csproj]
In my case, v1.9.3 works fine. v3.1.0 do not.
But AssemblyLoadContext.Default
is always in try{}
(v3.3.0 / v1.9.3). I don't know why this happened.
Summary of the issue
With UWP project exception occurs when running
BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED)
in very simple test project:Environment
Example code/Steps to reproduce:
If I create a blank UWP project, reference NuGet
System.Runtime.Loader
4.3.0
and callAssemblyLoadContext.Default
the above exception occurs.Interestingly, I have been using version
1.4.5
successfully with UWP. I believe this is because of a try catch (that was later removed starting in version1.5.0
) . See here. After upgrading NuGet package to1.5.0
an exception occurs becauseloadProperties
within the CjkFont` class does not include try/catch block. Subsequently, when I call FontFactory.GetFont, even with my custom registered font I get the below exception: