myroot = 'C:\Users\MyName\Documents\MATLAB\Test.NET'
mypath=fullfile(myroot,'\Summator\distrib');
addpath(mypath);
asm = NET.addAssembly(fullfile(mypath,'Summator.dll'));
import Summator.*;
try
mysummator = Summator.SumClass();
catch ex
disp(ex);
disp(ex.ExceptionObject);
disp(ex.ExceptionObject.TypeName);
disp(ex.ExceptionObject.Message);
disp(ex.ExceptionObject.InnerException);
disp(ex.ExceptionObject.TargetSite);
disp(ex.ExceptionObject.StackTrace);
disp(ex.ExceptionObject.Source);
end
myroot =
C:\Users\MyName\Documents\MATLAB\Test.NET
NET.NetException
Package: NET
Properties:
ExceptionObject: [1x1 System.TypeInitializationException]
identifier: 'MATLAB:NET:CLRException:CreateObject'
message: 'Message: The type initializer for 'Summator.SumClass' threw an exception.
Source: mscorlib
HelpLink: '
cause: {}
stack: [1x1 struct]
Methods, Superclasses
System.TypeInitializationException handle
Package: System
Properties:
TypeName: [1x1 System.String]
Message: [1x1 System.String]
Data: [1x1 System.Collections.ListDictionaryInternal]
InnerException: [1x1 System.TypeInitializationException]
TargetSite: [1x1 System.Reflection.RuntimeMethodInfo]
StackTrace: [1x1 System.String]
HelpLink: []
Source: [1x1 System.String]
HResult: -2146233036
Methods, Events, Superclasses
Summator.SumClass
The type initializer for 'Summator.SumClass' threw an exception.
System.TypeInitializationException handle
Package: System
Properties:
TypeName: [1x1 System.String]
Message: [1x1 System.String]
Data: [1x1 System.Collections.ListDictionaryInternal]
InnerException: [1x1 System.Exception]
TargetSite: [1x1 System.Reflection.RuntimeConstructorInfo]
StackTrace: [1x1 System.String]
HelpLink: []
Source: [1x1 System.String]
HResult: -2146233036
Methods, Events, Superclasses
System.Reflection.RuntimeMethodInfo handle
Package: System.Reflection
Properties:
Name: [1x1 System.String]
DeclaringType: [1x1 System.RuntimeType]
ReflectedType: [1x1 System.RuntimeType]
MemberType: [1x1 System.Reflection.MemberTypes]
MetadataToken: 100667905
Module: [1x1 System.Reflection.RuntimeModule]
IsSecurityCritical: 1
IsSecuritySafeCritical: 1
IsSecurityTransparent: 0
MethodHandle: [1x1 System.RuntimeMethodHandle]
Attributes: [1x1 System.Reflection.MethodAttributes]
CallingConvention: [1x1 System.Reflection.CallingConventions]
ReturnType: [1x1 System.RuntimeType]
ReturnTypeCustomAttributes: [1x1 System.Reflection.RuntimeParameterInfo]
ReturnParameter: [1x1 System.Reflection.RuntimeParameterInfo]
IsGenericMethod: 0
IsGenericMethodDefinition: 0
ContainsGenericParameters: 0
MethodImplementationFlags: [1x1 System.Reflection.MethodImplAttributes]
IsPublic: 0
IsPrivate: 0
IsFamily: 0
IsAssembly: 1
IsFamilyAndAssembly: 0
IsFamilyOrAssembly: 0
IsStatic: 1
IsFinal: 0
IsVirtual: 0
IsHideBySig: 1
IsAbstract: 0
IsSpecialName: 0
IsConstructor: 0
CustomAttributes: [1x1 System.Collections.ObjectModel.ReadOnlyCollection<System*Reflection*CustomAttributeData>]
Methods, Events, Superclasses
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at dotnetcli.NETConstructor.invoke(NETConstructor* , COSClient* client, Int32* nlhs, COSValue* plhs, Int32 nrhs, COSValue* prhs)
mscorlib