You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PLStream constructor throws an exception when called from a .NET Core 3.0 console application.
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'PLplot.Native' threw an exception.
Source=PLplotNet
StackTrace:
at PLplot.Native.mkstrm(Int32& p_strm)
at PLplot.PLStream..ctor() in C:...\PLStream.cs:line 24
at SineWaves.Program.Main(String[] args) in C:...\Program.cs:line 56
Inner Exception 1:
InvalidOperationException: Cannot find support PLplot support files in System.String[].
If called from a .NET Core 2.0 console application it works fine. I tested with the SineWaves console application from the c# samples.
I experienced the same issue
It seems like plplot dlls and fonts are not being loaded correctly in the NativeHelper.cs:
// The NuGet package ships with the PLplot DLLs and supporting font and// color map files. These files get installed into the directory "plplot", // either relative to the application main executable (if published),// or are located in the "runtimes/win-x64/native" folder of the NuGet package.// For PLplot to find its support files, the environment variable // PLPLOT_LIB must be set accordingly. string[]supPaths={Path.Combine(libDir,"plplot"),Path.Combine(libDir,"..","..","runtimes","win-x64","native","plplot")};stringsupPath=supPaths.FirstOrDefault(p =>Directory.Exists(p));if(supPath!=null){_putenv_s("PLPLOT_LIB",supPath);}else{thrownewInvalidOperationException($"Cannot find support PLplot support files in {supPaths}.");}
This was looking in the directories: {NugetPath}\plplot and {NugetPath}\..\..\runtimes\win-x64\native\plplot
Or when compiling locally {ProjectPathBinDirectory}\plplot and {ProjectPathBinDirectory}\..\..\runtimes\win-x64\native\plplot
supPath would always be null and therefore throw exception.
To resolve it locally, I changed the second supPath location to
Activity
acrigney commentedon May 6, 2020
I get the same problem with .net core 3.1 and with .net 2.0
DZFLUX commentedon May 8, 2020
I see the same issue on 3.x and works fine 2.2 for me.
geeky-krish commentedon Jul 24, 2022
I see the same issue in .Net6
cvizzini commentedon Oct 25, 2022
I experienced the same issue
It seems like plplot dlls and fonts are not being loaded correctly in the NativeHelper.cs:
This was looking in the directories:
{NugetPath}\plplotand{NugetPath}\..\..\runtimes\win-x64\native\plplotOr when compiling locally
{ProjectPathBinDirectory}\plplotand{ProjectPathBinDirectory}\..\..\runtimes\win-x64\native\plplotsupPathwould always be null and therefore throw exception.To resolve it locally, I changed the second
supPathlocation to