Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiException in Release mode (UWP) when calling LoginAsync #69

Closed
Sergio0694 opened this issue Sep 2, 2017 · 3 comments
Closed

ApiException in Release mode (UWP) when calling LoginAsync #69

Sergio0694 opened this issue Sep 2, 2017 · 3 comments

Comments

@Sergio0694
Copy link

Sergio0694 commented Sep 2, 2017

Description: I'm using the library in my UWP application and it works perfectly fine in debug mode. When compiled in Release mode though, I get the following exception:

image

Note the exception itself looks to be thrown in an auto-generated file, no idea what's up with it

It only happens in Release mode (when the .NET Native toolchain is enabled) when I call the MegaApiClient.LoginAsync method (I've double checked, the credentials are right).
As a result, I can't login at all in Release mode.

MegaApiClient Version: the official 1.6.0 package from NuGet

Hope this helps! 😄

@gpailler
Copy link
Owner

gpailler commented Sep 3, 2017

It's odd because MegaApiClient is not dependant of the compilation mode (Release version only in the nupkg) and the behavior should be the same between Debug or Release compilation. Maybe it's related to a dependency.

Could you show the exception details (message, stack trace, error code)?

@Sergio0694
Copy link
Author

Sergio0694 commented Sep 3, 2017

@gpailler I know the package is in Release only mode, but keep in mind that when compiling a UWP app (not a library) in Release, the .NET Native compiler kicks in, and it can sometimes cause glitches (specifically with the metadata/serialization part of the code).

Upon further investigation I think I found the cause of the issue:
image
The .NET Native compiler has some known issues with dynamic variables, so this code was working fine in Debug mode but not in release, as the metadata needed for the dynamic type was missing.
I've tried to manually include it in the Default.rd.xml file but it didn't work, so I ended up just doing this:

MegaApiClient.AuthInfos deserialized = JsonConvert.DeserializeObject<MegaApiClient.AuthInfos>(json);

This seems to have fixed the issue, so you might want to add a disclaimer for the right deserialization method to use in the readme file so other user won't have to deal with this problem again 😄

@gpailler
Copy link
Owner

Thanks. for the feedback I will update the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants