Bug #5403
closedSaxonCS NuGet SaxonCS.dll is for Amd64 processor architecture and that way doesn't work with Arm64 processors like Apple M1 and .NET 6
0%
Description
Based on my problems to use SaxonCS 11.2 from NuGet with .NET 6 on an Apple Mini M1 where any app fails with a "Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'SaxonCS, Version=11.2.0.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format." for SaxonCS.dll I file this bug to hopefully in the future have a SaxonCS for any CPU or MSIL or a dedicated .NET 6 package.
A simple .NET 5 console application using the NuGet package of SaxonCS 11.2 and outputting the processor architecture rom the assembly is
using System;
namespace SaxonCSAssemblyInspection
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(".NET {0}, OS {1}, 64bit {2}", Environment.Version, Environment.OSVersion, Environment.Is64BitOperatingSystem);
var saxonCSInfo = System.Reflection.AssemblyName.GetAssemblyName("SaxonCS.dll");
Console.WriteLine(saxonCSInfo.ProcessorArchitecture);
}
}
}
and outputs on a Mac M1
.NET 5.0.15, OS Unix 11.6.4, 64bit True
Amd64
If I add
var xmlResolverInfo = System.Reflection.AssemblyName.GetAssemblyName("XmlResolver.dll");
Console.WriteLine(xmlResolverInfo.ProcessorArchitecture);
that shows "MSIL".
Based on that I think it is not possible to use SaxonCS with .NET 6 on an M1 as the NuGet SaxonCS.dll targets only Amd64 and I think that should be fixed as .NET 6 is the long term .NET release and current/future packages integrate with .NET 6.
Please register to edit this issue