{"action":"created","issue":{"url":"https://api.github.com/repos/AttackPattern/CSharpAnalytics/issues/31","labels_url":"https://api.github.com/repos/AttackPattern/CSharpAnalytics/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/AttackPattern/CSharpAnalytics/issues/31/comments","events_url":"https://api.github.com/repos/AttackPattern/CSharpAnalytics/issues/31/events","html_url":"https://github.com/AttackPattern/CSharpAnalytics/issues/31","id":61413777,"number":31,"title":"Exception on Start()","user":{"login":"ncosentino","id":5169280,"avatar_url":"https://avatars.githubusercontent.com/u/5169280?v=3","gravatar_id":"","url":"https://api.github.com/users/ncosentino","html_url":"https://github.com/ncosentino","followers_url":"https://api.github.com/users/ncosentino/followers","following_url":"https://api.github.com/users/ncosentino/following{/other_user}","gists_url":"https://api.github.com/users/ncosentino/gists{/gist_id}","starred_url":"https://api.github.com/users/ncosentino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncosentino/subscriptions","organizations_url":"https://api.github.com/users/ncosentino/orgs","repos_url":"https://api.github.com/users/ncosentino/repos","events_url":"https://api.github.com/users/ncosentino/events{/privacy}","received_events_url":"https://api.github.com/users/ncosentino/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-14T04:48:40Z","updated_at":"2015-03-14T17:13:47Z","closed_at":null,"body":"Just wanted to give this library a whirl. Seems pretty easy to use, which was a big bonus for me. I had things working with these lines for my setup:\r\n\r\n```\r\nAutoMeasurement.Instance = new WinFormAutoMeasurement();\r\nAutoMeasurement.Instance.Start(new MeasurementConfiguration(\"UA-60679857-1\", Application.ProductName, Application.ProductVersion), \"Debug\");\r\n```\r\n\r\nAnd then on a screen I'd call\r\n\r\n```\r\nAutoMeasurement.Client.TrackScreenView(\"My Screen\");\r\n```\r\n\r\nNow on startup (specifically, only if I include the .Start() line, I get the following exception:\r\n\r\n> There was an error deserializing the object of type System.Collections.Generic.List`1[[System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]. The data at the root level is invalid. Line 1, position 1.\r\n>    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)\r\n>    at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)\r\n>    at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(Stream stream)\r\n>    at CSharpAnalytics.Serializers.AppDataContractSerializer.<Restore>d__0`1.MoveNext()\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n>    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n>    at CSharpAnalytics.WinFormAutoMeasurement.<Load>d__0`1.MoveNext()\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n>    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n>    at CSharpAnalytics.BaseAutoMeasurement.<StartRequesterAsync>d__9.MoveNext()\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n>    at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n>    at CSharpAnalytics.BaseAutoMeasurement.<Start>d__0.MoveNext()\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n>    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__1(Object state)\r\n>    at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)\r\n>    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n>    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n>    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()\r\n>    at System.Threading.ThreadPoolWorkQueue.Dispatch()\r\n>    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()\r\n> The data at the root level is invalid. Line 1, position 1.\r\n>    at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)\r\n>    at System.Xml.XmlUTF8TextReader.Read()\r\n>    at System.Xml.XmlBaseReader.IsStartElement()\r\n>    at System.Xml.XmlBaseReader.IsStartElement(XmlDictionaryString localName, XmlDictionaryString namespaceUri)\r\n>    at System.Runtime.Serialization.XmlReaderDelegator.IsStartElement(XmlDictionaryString localname, XmlDictionaryString ns)\r\n>    at System.Runtime.Serialization.XmlObjectSerializer.IsRootElement(XmlReaderDelegator reader, DataContract contract, XmlDictionaryString name, XmlDictionaryString ns)\r\n>    at System.Runtime.Serialization.DataContractSerializer.InternalIsStartObject(XmlReaderDelegator reader)\r\n>    at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)\r\n>    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)\r\n\r\nI feel like it's trying to restore some state or something, but I've blown away my bin directory and I've checked source control to ensure I have no other changes. It just stopped working out of (seemingly) nowhere and now I can't really do all that much.\r\n\r\nDefinite props for putting something together that's so easy to use though."},"comment":{"url":"https://api.github.com/repos/AttackPattern/CSharpAnalytics/issues/comments/80600328","html_url":"https://github.com/AttackPattern/CSharpAnalytics/issues/31#issuecomment-80600328","issue_url":"https://api.github.com/repos/AttackPattern/CSharpAnalytics/issues/31","id":80600328,"user":{"login":"ncosentino","id":5169280,"avatar_url":"https://avatars.githubusercontent.com/u/5169280?v=3","gravatar_id":"","url":"https://api.github.com/users/ncosentino","html_url":"https://github.com/ncosentino","followers_url":"https://api.github.com/users/ncosentino/followers","following_url":"https://api.github.com/users/ncosentino/following{/other_user}","gists_url":"https://api.github.com/users/ncosentino/gists{/gist_id}","starred_url":"https://api.github.com/users/ncosentino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncosentino/subscriptions","organizations_url":"https://api.github.com/users/ncosentino/orgs","repos_url":"https://api.github.com/users/ncosentino/repos","events_url":"https://api.github.com/users/ncosentino/events{/privacy}","received_events_url":"https://api.github.com/users/ncosentino/received_events","type":"User","site_admin":false},"created_at":"2015-03-14T17:13:47Z","updated_at":"2015-03-14T17:13:47Z","body":"Figured I'd mention this in the same spot since you said you'd be looking at the WinForm/WPF implementations... It looks like between application restarts as long as I have one of those session files, I can't seem to get metrics sent off. As soon as I delete those two files, things go back to normal.\r\n\r\nI tried poking around in the WinForms code, and got back to the AppDataContractSerializer. Within here, the line that actually performs the return is never hit (and the exception handlers around this code don't seem to get hit either).\r\n\r\n```\r\nusing (var memoryStream = new MemoryStream())\r\n{\r\n    await inputStream.CopyToAsync(memoryStream);\r\n    await inputStream.FlushAsync();\r\n    memoryStream.Seek(0, SeekOrigin.Begin);\r\n\r\n    return (T)serializer.ReadObject(memoryStream);\r\n}\r\n```\r\n\r\nIt's as if the files will just hang on being loaded if they exist, unless I'm misunderstanding how the async behaviour is working. Again, not sure if it's related at all, but I didn't want to tack on another issue if you think this type of thing is related."}}