Re: NET.addAssembly warnings



Joel wrote:
I have a top-level script that calls a function, both of which use .NET. So both of them call NET.addAssembly to load the specific assemblies they need.

The problem is, every time I run the script, I get a load of warnings from the inner function, saying that the particular assembly is already loaded.

Is there a way to hide these warnings, or detect if an assembly is already loaded before loading it again?

Here's a sample warning:
Warning: Assembly '<assemblyName>' has already been added from
location '<assemblyDir>'.

Thanks.
Hi Joel,

You can use the LASTWARN function in MATLAB to get the message identifier for the last warning message displayed in MATLAB. You can then use this identifier and turn the warning off with the WARNING method.

To view a list of assembles currently loaded into MATLAB, you can use AppDomain.GetAssemblies as follows

function listAssemblies
% View assemblies currently visible to MATLAB
domain = System.AppDomain.CurrentDomain;
assemblies = domain.GetAssemblies;
for i= 1:assemblies.Length
asm = assemblies.Get(i-1);
disp(char(asm.FullName));
end
end

You can tweak the above function so that it performs a check for whether or not your assembly is currently loaded.

HTH,
Chitra.
.



Relevant Pages

  • Re: VS2008
    ... assemblies referenced and the compiler is not sure what to do about it. ... to solve conflict and get rid of warning. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Problems with Re-Usable ASP.NET User Control Libraries
    ... Since the PublishSite generated assemblies are the same as those generated ... current Request's associated ApplicationInstance object... ... And as for the warning, it is because when the first time our reusable page ... Microsoft Online Support ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • VB.Net project throwing errors when executing Clean Solution
    ... It references 5 other assemblies. ... For some reason, when we try to ... the VB project throws 43 errors and 1 spurrious warning. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Build errors whith two identical assembliey names
    ... warning MSB3247: Found conflicts between different versions of the same ... > Target ResolveProjectReferences: ... >> I have a project where I load some of my assemblies dynamically, ...
    (microsoft.public.dotnet.general)
  • Re: Problems saving plot to .png with -nodisplay switch
    ... I am having problems saving plots to a png file when running matlab ... I run most of my matlab scripts in batch-mode so saving plots to disk ... or any of its super-classes ... Warning: Objects of graphics.zoombehavior class exist - not clearing ...
    (comp.soft-sys.matlab)