my problem is when want to include the matlab build library dll file in c# project there will be an error! anyone have experience with this problem and solution for it? thanks!

problem description

this is my simple matlab code

function y = getMatlabMagic(x)

y = magic(x);

Then i use deploy to build my project! compiler choosen is microsoft c/c++ 8.0.
and using private type!

then in my console coding like

using System;
using System.Collections.Generic;
using System.Text;
using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.Arrays;
using magic;

namespace celltest3
    class Program
        static void Main(string[] args)
            MWCellArray cellout = null;
                magicclass obj = new magicclass();
            catch (Exception exception)   
                Console.WriteLine("Error: {0}", exception);    


until the magicclass obj = new magicclass() there already have error! it mention

System.TypeInitializationException: The type initializer for 'magic.magicclass' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at MathWorks.MATLAB.NET.Utility.MWMCR..ctor(String componentName, String rootData, Byte[] publicEncryptionKey, Byte[] sessionEncryptionKey, String[] matlabPathEntries, String[] classPathEntries, String[] libPathEntries, String[] mcrApplicationOptions, String[] mcrRuntimeOptions, String prefDir, String[] mcrSetWarningState, String componentPath, Boolean isLibrary)
at CellExample.CellExampleclass..cctor()
--- End of inner exception stack trace ---
at CellExample.CellExampleclass..ctor()

Please Help! Thanks!

9 Years
Discussion Span
Last Post by azran
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.