Library is failing to work with the invariant culture.
PackageReference Aspose.Slides.NET6.CrossPlatform 23.11.0
SpreadsheetOptions constructor is failing on initialization of the CultureInfo because US locale is harcoded.
It’s not possible to pass another culture info while exception occur in the contructor.
Steps to reproduce:
Set invariant culture in the project configuration file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
</Project>
OR set by using next env variable (bash/git bash):
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
Globalization config settings - .NET | Microsoft Learn
Code
using (var presentation = new Aspose.Slides.Presentation(sourcePresentation))
{
// save the presentation to PDF
presentation.Save(outputFile, Aspose.Slides.Export.SaveFormat.Pdf);
}
See exception
Only the invariant culture is supported in globalization-invariant mode. See Globalization config settings - .NET | Microsoft Learn for more information. (Parameter ‘name’)
en-US is an invalid culture identifier.
at System.Globalization.CultureInfo…ctor(String name, Boolean useUserOverride)
at System.Globalization.CultureInfo…ctor(String name)
at Aspose.Slides.SpreadsheetOptions…ctor()
at Aspose.Slides.LoadOptions…ctor()