Within Visual Studio, a first-chance exception of type InvalidCastException is getting thrown within ESRI.ArcGIS.Client.Map.GetHtmlPageDpi. I should not have to turn off catching these exceptions from within the debugger to avoid hitting this problem. To me, it appears the problem is that the API calls HtmlPage.Window.Eval("screen.deviceXDPI") and casts it to a float, however that Silverlight API returned a boxed double so the direct cast to a float is causing an exception. I believe the implementation should be changed to either do a double cast (i.e. Map._Dpi = (float)(double)HtmlPage.Window.Eval("screen.deviceXDPI")) or use Convert.ToSingle(HtmlPage.Window.Eval("screen.deviceXDPI")).
This might also have the effect of using the correct screen DPI on high resolution monitors. I can't verify this, as I don't have a high resolution monitor.
Thanks,
Justin
Hi Justin,
Sorry for that inconvenience and thank you for your suggestion. We'll try to include this fix in future release.
Thanks.
Hi Justin,
What version of ArcGIS API for Silverlight do you have? I'm only able to reproduce the issue if I build our source code (debug|release) but I couldn't reproduce with current released 3.2 assemblies.
Thanks.
Jennifer