-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching & Cross Thread exception #15
Comments
no idea, unfortunately... seeing as how you can't reproduce this, i assume it happens infrequently? if so, can you keep an eye on it to see if it always happens for the same type of request? If so, it would be interesting to see in how many places the request is sent, and if it always fails for a specific call, or if it fails on multiple calls. |
Hi, I had a similar problem when issuing requests on background threads. Something like this:
|
Yeah, I was executing this in OnInitialize (from the Caliburn framework):
(the repository call translates to a Agatha request) I first tried without the Execute on UI thread. then I figured the Timer uses a DispatcherTimer so I tried to execute the callback on the UI thread. Both error. If I remove the execute on background thread, it works. But it blocks the UI I will try your timer implementation, but with a normal Timer, don't you have to handle UI thread synchronisation yourself? Edit: seems to work, no issues yet. |
There is no need to do UI thread sync when using Caliburn.... the framework marshals PropertyChanged events to the UI thread regardless of the thread from which you are modifying your properties (see http://caliburn.codeplex.com/wikipage?title=PropertyChangedBase%20and%20BindableCollection&referringTitle=Documentation ) |
Hey,
from time to time (cannot reproduce this, it happens after some time working with our silverlight app) I get this exception (see below).
Using the latest (1.3) from NuGet.
Any idea?
Remco Ros
Default.aspx:59Uncaught Error: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.UnauthorizedAccessException: Invalid cross-thread access.
at MS.Internal.XcpImports.CheckThread()
at MS.Internal.XcpImports.CreateObjectByTypeIndex(UInt32 typeIndex)
at System.Windows.Threading.DispatcherTimer..ctor(UInt32 nativeTypeIndex)
at System.Windows.Threading.DispatcherTimer..ctor()
at Agatha.Common.Caching.Timers.TimerWrapper.Start()
at Agatha.Common.Caching.InMemoryCache.Store(Request request, Response response, TimeSpan expiration)
at Agatha.Common.Caching.CacheManager.StoreInCache(Request request, Response response, TimeSpan expiration, String region)
at Agatha.Common.Caching.CacheManager.StoreInCache(Request request, Response response)
at Agatha.Common.ResponseReceiver.AddCacheableResponsesToCache(Response[] receivedResponses, Request[] requestsToSend)
at Agatha.Common.ResponseReceiver.ReceiveResponses(ProcessRequestsAsyncCompletedArgs args, Response[] tempResponseArray, Request[] requestsToSendAsArray)
at Agatha.Common.AsyncRequestDispatcher.OnProcessRequestsCompleted(ProcessRequestsAsyncCompletedArgs args, ResponseReceiver responseReciever, Response[] tempResponseArray, Request[] requestsToSendAsArray)
at Agatha.Common.AsyncRequestDispatcher.<>c__DisplayClass4.b__0(ProcessRequestsAsyncCompletedArgs a)
at Agatha.Common.WCF.AsyncRequestProcessorProxy.OnProcessRequestsCompleted(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
The text was updated successfully, but these errors were encountered: