Subscribe to this thread
Home - General / All posts - System.Memory and dll loading
593 post(s)
#01-Apr-22 10:42

I figured something out. I tried IronPython 3.4.0 and got error of not being able to load System.Memory v4.0.1.1

System.Memory.dll comes with and is placed right next to Ironpython.dll in manifold/shared.

Using Process Monitor (Tools -> File summary) I could see that manifold process looks for System.Memory from following locations but not where Ironpython.dll, which requires it, is.

C:\Program Files\Manifold\v9.0\bin64\System.Memory.dll

C:\Program Files\Manifold\v9.0\bin64\System.Memory.exe

C:\Program Files\Manifold\v9.0\bin64\System.Memory

C:\Program Files\Manifold\v9.0\Bin64\System.Memory\System.Memory.dll

C:\Program Files\Manifold\v9.0\Bin64\System.Memory\System.Memory.exe







Workaround is to copy System.Memory to bin64.

I know from previous experience that I can put gdal.dll in any subfolder to bin64, but plugins for gdal MUST be at bin64\gdalplugins. Otherwise manifold process does not find them. Usually gdalplugins folder is relative to gdal.dll.

This looks like "current directory" or "relative path" issue.

I could probably install System.Memory into GAC but I read there are some issues(*). I do not understand if I should avoid GAC or just use it and not worry.



10,391 post(s)
#04-Apr-22 08:16

That looks like the standard binding process done by Fusion (part of .NET).

What exactly is the dependency on System.Memory.dll - I take it you have an assembly that is referencing it (has been compiled with a reference to it), right? How are you loading that assembly? Dynamically through reflection? Through $reference$ in a script? Or somehow differently?

In general, we can control the binding process and make it go through ~/shared, ~/binXX/*, etc.

GAC is generally best avoided, used as a last resort (because if everyone starts using it, the result is a mess with new and new things having to go into GAC and multiple versions of the same DLLs staying there forever).

593 post(s)
#04-Apr-22 09:14

Ironpython 3.4-beta requires System.Memory. (2.7.x do not.)

3.4 includes 3 new dlls compared to 2.7.x










I just open New Command Window -> Ironptyhon

Simple 2+2 works. Other things not, if I remove System.Memory from bin64.

> 245725674562435*2457245724562435

Exception has been thrown by the target of an invocation.

 Could not load file or assembly 'System.Memory, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

> 2+2


593 post(s)
#26-Jul-22 19:17

With changes in, System.Memory.dll is now found.

ProcessMonitor events:

C:\Windows\Microsoft.Net\assembly\GAC_64\System.Memory\v4.0_4.0.1.1__cc7b13ffcd2ddd51\System.Memory.dll                 PATH NOT FOUND

C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Memory\v4.0_4.0.1.1__cc7b13ffcd2ddd51\System.Memory.dll               PATH NOT FOUND

C:\Windows\Microsoft.Net\assembly\GAC\System.Memory\v4.0_4.0.1.1__cc7b13ffcd2ddd51\System.Memory.dll                    PATH NOT FOUND

C:\Windows\assembly\GAC_64\System.Memory\\System.Memory.dll                                    PATH NOT FOUND

C:\Windows\assembly\GAC_MSIL\System.Memory\\System.Memory.dll                                  PATH NOT FOUND

C:\Windows\assembly\GAC\System.Memory\\System.Memory.dll                                       PATH NOT FOUND

D:\Manifold-9-Edge\System.Memory.dll                                                                                    NAME NOT FOUND

D:\Manifold-9-Edge\System.Memory\System.Memory.dll                                                                      PATH NOT FOUND

D:\Manifold-9-Edge\extras\IronPython\System.Memory.dll                                                                  SUCCESS

69 post(s)
#16-Aug-22 15:15

Thank you rk this was extremely helpful. I was getting the same exception (could not load file...the system could not find..." when I attempted to execute the default code inside a new script (Hello World posted into the Log window) inside Manifold.

For anyone else attempting this.....

For good measure the first thing I did was to download the latest .NET SDK and install it (at this point in time dotnet-sdk-6.0.400-win-x64).

After installing Ironpython3 I copied the 9 dlls you listed in your 04-Apr-22 09:14 post into \shared\ironpython\ and all is well inside Manifold for executing ironpython scripts.

My System

Windows 10

Manifold System Universal Build (2-Jul-2022)

IronPython 3.4.0-beta1

593 post(s)
#23-Aug-22 18:47

There is one more thing. I discovered it with another add-in, but IronPython3 may also be affected.

It took many hours to solve.

Sometimes System.Buffers.dll must be loaded. There is a bug or something with versions of System.Buffers. The attached file solved it. Put it next to manifold.exe.


Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.