.NET assembly load failure

조회 수: 59 (최근 30일)
Phillip
Phillip 2014년 4월 8일
댓글: KAE 2024년 3월 12일 17:32
Hi
I have the following problem when trying to load a .NET Assembly.
>> asm = NET.addAssembly('c:\Assembly\MyAssembly.dll')
Message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. Source: mscorlib
HelpLink:
>>
I suspect it has to do with it not being able to find some of the dependencies. That error is thrown by the .NET environment and not Matlab directly. Without having to move into a development environment can I access the .Net LoaderExceptions properties directly in Matlab somehow?
As far as I'm aware all dependencies reside in the main dll folder but one of them seems to be failing.
Thanks, Phil

답변 (1개)

Shd
Shd 2016년 2월 12일
This code works for me:
try
NET.addAssembly(assembly)
catch ex
end
ex.ExceptionObject.LoaderExceptions.Get(0).Message
  댓글 수: 1
KAE
KAE 2024년 3월 12일 17:32
When I put this in a mfile then compiled the mfile, and ran the resulting exe from the Windows 11 command line, I got,
Unrecognized method, property, or field 'ExceptionObject' for class 'MException'.
Any idea why? This is in R2023b.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Getting Started with Microsoft .NET에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by