Bug 5263 - Key duplication when adding: authentication
Summary: Key duplication when adding: authentication
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-22 22:16 UTC by pgentoo
Modified: 2015-02-20 11:25 UTC (History)
2 users (show)

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


Attachments
Add lock to the getter of the indexer (3.89 KB, patch)
2015-02-09 04:14 UTC, Juan Carreño
Details


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 pgentoo 2012-05-22 22:16:35 UTC
Message: Key duplication when adding: authentication
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.Specialized.NameObjectCollectionBase.BaseAdd (System.String name, System.Object value) [0x00000] in <filename unknown>:0
  at System.Collections.Specialized.NameObjectCollectionBase.BaseSet (System.String name, System.Object value) [0x00000] in <filename unknown>:0
  at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
  at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
  at System.Web.Security.FormsAuthenticationModule.InitConfig (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.Security.FormsAuthenticationModule.OnAuthenticateRequest (System.Object sender, System.EventArgs args) [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication+<RunHooks>c__Iterator5.MoveNext () [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication+<Pipeline>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0 Entire Exception: System.ArgumentException: Key duplication when adding: authentication
  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.Specialized.NameObjectCollectionBase.BaseAdd (System.String name, System.Object value) [0x00000] in <filename unknown>:0
  at System.Collections.Specialized.NameObjectCollectionBase.BaseSet (System.String name, System.Object value) [0x00000] in <filename unknown>:0
  at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
  at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
  at System.Web.Security.FormsAuthenticationModule.InitConfig (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
  at System.Web.Security.FormsAuthenticationModule.OnAuthenticateRequest (System.Object sender, System.EventArgs args) [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication+<RunHooks>c__Iterator5.MoveNext () [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication+<Pipeline>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
Comment 1 Juan Carreño 2015-02-09 04:14:26 UTC
Created attachment 9702 [details]
Add lock to the getter of the indexer

I was facing the same issue, and it seems to be caused because ConfigurationSectionGroupCollection is not thread-safe. 

Adding a lock to the method should solve the issue.
Comment 2 Miguel de Icaza [MSFT] 2015-02-20 11:25:57 UTC
Applied the patch from:

https://github.com/mono/mono/pull/1582