Home

System.Numerics.MPFR works in LINQPad 5 but not working in LINQPad 6

NuGet Package System.Numerics.MPFR(https://www.nuget.org/packages/System.Numerics.MPFR/).

Following error prompted when initialize BigFloat:


Code:
var f = new BigFloat("79228162514264337593543950335");
f.Add(0.1);
f.ToString().Dump();

Comments

  • edited November 2019
    After taking a quick look at that package, I can see immediately what the problem is. In the InstallInternalLibrary() method, it starts a process like this:
    ProcessStartInfo startInfo = new ProcessStartInfo("7zdec.exe")
    {
    	WorkingDirectory = AssemblyLocation,
    	Arguments = "x mpfr_gmp.7z",
    	WindowStyle = ProcessWindowStyle.Hidden,
    };
    ...
    It should be doing this:
    ProcessStartInfo startInfo = new ProcessStartInfo("7zdec.exe")
    {
    	WorkingDirectory = AssemblyLocation,
    	Arguments = "x mpfr_gmp.7z",
    	WindowStyle = ProcessWindowStyle.Hidden,
    	UseShellExecute = true
    };
    ...
    There was a breaking change in .NET Core - they changed the default for UseShellExecute from true to false.

    Without UseShellExecute, it will work reliably only in .NET Framework. In .NET Core, it will fail unless the 7zdec.exe file happens to be in the current directory. As a workaround, you can force it to the current directory via the option in Query Properties > Advanced.
Sign In or Register to comment.