Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6021


Ignore:
Timestamp:
04/18/11 17:33:41 (14 years ago)
Author:
gkronber
Message:

#1348: added ContainsKey check and throw ArgumentException with a more descriptive error message.

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs

    r5903 r6021  
    151151    // register assembly in the assembly cache for the AssemblyResolveEvent
    152152    private void RegisterLoadedAssembly(Assembly asm) {
     153      if (loadedAssemblies.ContainsKey(asm.FullName) || loadedAssemblies.ContainsKey(asm.GetName().Name)) {
     154        throw new ArgumentException("An assembly with the name " + asm.GetName().Name + " has been registered already.", "asm");
     155      }
    153156      loadedAssemblies.Add(asm.FullName, asm);
    154157      loadedAssemblies.Add(asm.GetName().Name, asm); // add short name
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs

    r5652 r6021  
    606606    // register assembly in the assembly cache for the ReflectionOnlyAssemblyResolveEvent
    607607    private void RegisterLoadedAssembly(Assembly asm) {
     608      if (reflectionOnlyAssemblies.ContainsKey(asm.FullName) || reflectionOnlyAssemblies.ContainsKey(asm.GetName().Name)) {
     609        throw new ArgumentException("An assembly with the name " + asm.GetName().Name + " has been registered already.", "asm");
     610      }
    608611      reflectionOnlyAssemblies.Add(asm.FullName, asm);
    609612      reflectionOnlyAssemblies.Add(asm.GetName().Name, asm); // add short name
Note: See TracChangeset for help on using the changeset viewer.