This project has moved. For the latest updates, please go here.

InvalidCastException when using SharpGzip?

Sep 15, 2012 at 9:48 AM

After reading recommendations for using GZip from Jeff Wilcox and finding out that AgFx supported it, I added these two lines to my App constructor after the Debugger.IsAttached if statement:

WebRequest.RegisterPrefix("http://", SharpGIS.WebRequestCreator.GZip);
WebRequest.RegisterPrefix("https://", SharpGIS.WebRequestCreator.GZip);

At first, it appears that my application works fine, as the homepage loads and displays properly despite having an AgFx-enabled viewmodel. However, when I later try to access a 'details' page, I get an InvalidCastException error with this stack trace:

   at AgFx.WebLoadRequest.<>c__DisplayClass3.<>c__DisplayClass6.b__1(IAsyncResult asyncObject)
   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.b__8(Object state2)
   at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadPool.WorkItem.doWork(Object o)
   at System.Threading.Timer.ring()
Any idea why this may be happening?