Select to view content in your preferred language

First chance exception within Map.GetHtmlPageDpi

2322
2
12-02-2014 12:40 PM
JustinBurtch
Deactivated User

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

0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor

Hi Justin,


Sorry for that inconvenience and thank you for your suggestion. We'll try to include this fix in future release.

Thanks.

0 Kudos
JenniferNery
Esri Regular Contributor

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

0 Kudos