[Mono-bugs] [Bug 575439] New: RuntimeLicenseContext.LoadAssemblyLicenses throws "System.ArgumentException : Key duplication..."

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jan 29 18:10:29 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=575439

http://bugzilla.novell.com/show_bug.cgi?id=575439#c0


           Summary: RuntimeLicenseContext.LoadAssemblyLicenses throws
                    "System.ArgumentException : Key duplication..."
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kring at agi.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:
RuntimeLicenseContext.LoadAssemblyLicenses throws a System.ArgumentException
when multiple assemblies in the app domain contain licenses for the same class.
 Microsoft .NET does not throw an exception under the same circumstances - it
appears to just use the first one it finds.

The exception is:
System.ArgumentException : Key duplication when adding:
AGI.Foundation.Licensing, AGI.Foundation.Core, Version=999.0.691.0,
Culture=neutral, PublicKeyToken=46f7a65aaf1b26a0

And the call stack from Mono looks like this:

at System.Collections.Hashtable.PutImpl (System.Object key, System.Object
value, Boolean overwrite) [0x00000] in <filename unknown>:0
at System.Collections.Hashtable.Add (System.Object key, System.Object value)
[0x00000] in <filename unknown>:0
at System.ComponentModel.Design.RuntimeLicenseContext.LoadAssemblyLicenses
(System.Collections.Hashtable targetkeys, System.Reflection.Assembly asm)
[0x00000] in <filename unknown>:0
at System.ComponentModel.Design.RuntimeLicenseContext.LoadKeys () [0x00000] in
<filename unknown>:0
at System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey
(System.Type type, System.Reflection.Assembly resourceAssembly) [0x00000] in
<filename unknown>:0
..

Steps to reproduce the problem:
1. Create two assemblies with licenses for the same class.  This can be
accomplished by adding the same licx file to both projects.
2. Load both assemblies into the appdomain.  An easy way to do this is to load
both assemblies into NUnit.
3. Call
LicenseManager.CurrentContext.GetSavedLicenseKey(typeof(MyLicenseClass)).


Actual Results:
A System.ArgumentException is thrown.

Expected Results:
There is no exception and the first license found is returned.

How often does this happen? 
Only on the first call to LicenseManager.CurrentContext.GetSavedLicenseKey. 
Later calls return without error.  This is because the first license is loaded
successfully before the exception occurs, and GetSavedLicenseKey does not load
licenses a second time once the 'keys' Hashtable has been initialized.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list