canderso / Mixpanel

A .NET Mixpanel API to add tracking to your Windows Phone, WinRT and .NET 4 apps. The complete Mixpanel API is supported (tracking events and all types of profile updates). The API also supports offline mode and bad networks: if element could not be sent, it'll be stored locally and sent later on.
10 stars 2 forks source link

Unhandled exception takes out the process... #4

Open tomcarver opened 7 years ago

tomcarver commented 7 years ago

Sorry to post a cryptic issue but I can't really follow where the problem is... it's only happened once, the rest of the time everything works fine, but killing the process does make you sit up and take notice:

On one occasion immediately after calling MixpanelClient.GetCurrentClient(), the following exception occurred. The exception bubbles all the way to ThreadPoolWorkQueue without being handled and this takes out the whole process.

System.IO.IsolatedStorage.IsolatedStorageException: Unable to create the store directory. (Exception from HRESULT: 0x80131468)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope, StringHandleOnStack retRootDir)
at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at Mixpanel.MixpanelClient.TrySendLocalElements()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

The hard disk has multiple GB free and I can't find any clues in the IsolatedStorage docs or forum posts about how this could occur sometimes and not others - it feels like an "always" or "never" error frankly.... but it definitely happened so I thought I'd post it here.

Judging by the timestamps on the latest revision I'm not expecting an immediate fix, but hopefully documenting the issue here can save someone else some time.

petterh commented 7 years ago

This SO thread seems relevant.

tomcarver commented 7 years ago

Thanks for the reply! Yeah I'd found this thread before. If I got this exception on every call to MixpanelClient.GetCurrentClient() then I'd agree, account permissions could explain it. But this code has run without error for a few weeks before throwing the exception with no change to the environment or any of the user accounts, and every call to the API is prompted by the same route into the application (HTTP request to Nancy).