How to resolve Type Initializer for MWNumericArray Exception?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 7 Nov 2025 at 0:00
Answered: MathWorks Support Team
on 14 Nov 2025 at 20:06
I am encountering the following error when trying to import "MWNumericArray" in IronPython 3.4.2:
SystemError: The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWNumericArray' threw an exception.
The same code works without issues on several other PCs that have identical configurations (same OS, .NET Framework, and MATLAB Runtime). However, on one particular PC, I consistently get the error above.
How can I resolve this issue?
Accepted Answer
MathWorks Support Team
on 7 Nov 2025 at 0:00
To resolve the above error, please follow the below steps:
1. Run “gacutil /l MWArray” in Visual Studio Developer Command Prompt to verify the installed version of MWArray.
2. If you receive a “command not found” error, you can typically find “gacutil.exe” at:
C:\Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/gacutil
3. Once you have identified the installed version, please update your code to use:
clr.AddReference("MWArray, Version=<version_number>")
Replace “<version_number>” with the version you found in step 1. Check if this resolves the error.
4. If the issue persists, please install the latest Visual C++ Redistributable, following the instructions here:
5. After installing the redistributable, run your code again to see if the problem is resolved.
These steps should help you identify and fix the problem on the affected PC.
0 Comments
More Answers (0)
See Also
Categories
Find more on Deploy to .NET Applications Using MWArray API in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!