Bug 5656 - Application.Lock() does not acquire lock
Summary: Application.Lock() does not acquire lock
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-06-14 14:26 UTC by Frank Cohen
Modified: 2012-06-14 17:22 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 for Bug 5656 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Frank Cohen 2012-06-14 14:26:43 UTC
I am trying to run DotNetOpenAuth under Mono 2.10.  I am running it in a .NET MVC2 application.

The original code looks like this:

context.Application.Lock();

                    try
                    {
                        if ((store = (IRelyingPartyApplicationStore)context.Application[ApplicationStoreKey]) == null)
                        {
                            context.Application[ApplicationStoreKey] = store = new StandardRelyingPartyApplicationStore();
                        }
                    }
                    finally
                    {
                        context.Application.UnLock();
                    }



when the code hits the finally block, I get an exception which indicates the lock was never acquired:

System.Threading.SynchronizationLockException: The current thread has not entered the lock in read mode
  at System.Threading.ReaderWriterLockSlim.ExitReadLock () [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplicationState.Get (System.String name) [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplicationState.get_Item (System.String name) [0x00000] in <filename unknown>:0 
  at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.get_HttpApplicationStore () [0x00000] in <filename unknown>:0 
  at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty..ctor () [0x00000] in <filename unknown>:0

I have modified the code to remove the code to context.Application.Lock()

There are other users who have experienced the same thing, so it seems:

http://www.mojoportal.com/Forums/Thread.aspx?pageid=5&mid=34&ItemID=3&thread=7946&pagenumber=1

http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg82688.html

http://mono.1490590.n4.nabble.com/issue-with-Application-Lock-td3327729.html
Comment 1 Zoltan Varga 2012-06-14 17:22:13 UTC
-> sys.web.