Bug 14720 - Exception about Key duplication when using App_Browser/Default.browser
Summary: Exception about Key duplication when using App_Browser/Default.browser
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-09-13 12:50 UTC by dricks2222@yahoo.com
Modified: 2013-10-10 21:30 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description dricks2222@yahoo.com 2013-09-13 12:50:58 UTC
Using Mono 3.2.3 on a NGinx web server :

With an ASP.Net application, if you want to use a ControlAdapter, you have to add a :
'WebApplication/App_Browser/Default.browser' file and add in it :

<browsers>
    <browser refID="Default">
        <controlAdapters>
            <adapter controlType="System.Web.UI.Page" adapterType="MyAdapterNameSpace.MyAdapterClass" />
        </controlAdapters>
    </browser>
</browsers>


Open one of your webpage using Internet Explorer 8, and you will get something like this :
System.ArgumentException
Key duplication when adding: vbscript

Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): mscorlib.

Exception stack trace:
  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.Collections.Hashtable..ctor (IDictionary d, Single loadFactor, IHashCodeProvider hcp, IComparer comparer) [0x00000] in <filename unknown>:0 
  at System.Collections.Hashtable..ctor (IDictionary d, Single loadFactor) [0x00000] in <filename unknown>:0 
  at System.Collections.Hashtable..ctor (IDictionary d, Single loadFactor, IEqualityComparer equalityComparer) [0x00000] in <filename unknown>:0 
  at System.Collections.Hashtable..ctor (IDictionary d, IEqualityComparer equalityComparer) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.HttpCapabilitiesBase.set_Capabilities (IDictionary value) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.CapabilitiesResult..ctor (IDictionary items) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.nBrowser.Result..ctor (IDictionary items) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.nBrowser.Build.Process (System.Collections.Specialized.NameValueCollection header, IDictionary initialCapabilities) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.CapabilitiesBuild.Process (System.Web.HttpRequest request, IDictionary initialCapabilities) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.HttpCapabilitiesBase.GetConfigCapabilities (System.String configKey, System.Web.HttpRequest request) [0x00000] in <filename unknown>:0 
  at System.Web.HttpRequest.get_Browser () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Control.ResolveAdapter () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Control.get_Adapter () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.get_PageAdapter () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 


I think there is a problem related to Overrinding values in the Browscap parser ?
Maybe something like this :
if (browserCapabilities.ContainsKey(capability_key))
	browserCapabilities[capability_key]=capability_value;
else
	browserCapabilities.Add(capability_key,capability_value);

could resolve it ?
Comment 1 Andres G. Aragoneses 2013-09-22 18:34:14 UTC
This has been fixed in master:

https://github.com/mono/mono/commit/03e31732d3d09392d307b6c91e3d8bc9f992b1a4

So please can anyone close the bug as RESOLVED->FIXED? Thanks
Comment 2 Jonathan Pryor 2013-10-10 21:30:27 UTC
Marking Fixed as per Comment #1.