jamesmontemagno / DeviceInfoPlugin

Device Information Plugin for Xamarin and Windows
Other
145 stars 44 forks source link

[URGENT] Cannot get "Platform" value before a window is being activated in UWP project #68

Closed goldmont closed 5 years ago

goldmont commented 5 years ago

Version Number of Plugin: 4.0.0.13 Device Tested On: Windows 10 (1809) Version of VS: Community V15.9.4 (4.7.03190) Version of UWP: 6.2.2

Hi,

I'm working on a UWP project and if I try to get the Platform value before a window is being activated, I get a System.Exception. The issue is with this line of code because your library checks whether the UserInteractionMode is Mouse or Touch and this is only possible with an active window. Since I need to get the Platform value when my App has just started, the library fails. I need an urgent fix, please.

Thanks for your efforts.

Best regards, Giuseppe Montuoro, Italy.

jamesmontemagno commented 5 years ago

There is a try catch around that so should be just fine.... did you copy and paste this code into your app and run it?

goldmont commented 5 years ago

Yeah, directly in the project it works fine. By the way, I'm getting the Platform value from inside a NuGet package made by me. The exception returns the following message:

System.Exception: Unable to locate element.

Do you think it's an issue related to my library? Thanks.

jamesmontemagno commented 5 years ago

Do you have a stack trace? With a try catch like I have I don't see how it can crash.

jamesmontemagno commented 5 years ago

I put some more checks into 4.1.0-beta, you can try that... but again my code shouldn't crash as i try/catch. Let me know. Closing out.