Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

../iOS/MTOUCH: Error MT2002: Failed to resolve "System.Json.JsonValue" reference from "Xamarin.Auth, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null" (MT2002) (project_name.iOS) #234

Open
1 of 3 tasks
DuarthVader opened this issue Sep 26, 2017 · 6 comments
Assignees
Labels
needs-info More information is requested by engineering
Projects

Comments

@DuarthVader
Copy link

DuarthVader commented Sep 26, 2017

Xamarin.Auth Issue

Version

  • nuget version = 4.3.0.2418
  • component version = 1.5.0.3
  • sample

Steps to reproduce

Release:

  1. Compile iOS project

Debug:

  1. Click play to run app in simulator.
  2. Perform any login atempt (in my app: Facebook, Google, Linked In)
  3. Fails due to error seen in screenshot below.

Platform:

  • [] .NET version = .NET Core
    Runtime: /usr/local/share/dotnet/dotnet
    Runtime Version: 2.0.0
    SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
    SDK Version: 2.0.0
    MSBuild SDKs:
    /Library/Frameworks/Mono.framework/Versions/
    5.2.0/lib/mono/msbuild/15.0/bin/Sdks

  • [] mono version = 5.2.0.224 (d15-3/14f2c81) (64-bit)

Expected behaviour

Release: Compile project in order to generate .ipa
Debug: Get auth login response, convert into JsonValue in order to deserialize response.

Actual behaviour

Release: Compilation error

captura de pantalla 2017-09-26 a las 13 27 40

Debug: When app is about to come back to my LoginViewModel I receive this exception:

captura de pantalla 2017-09-26 a las 13 32 24

captura de pantalla 2017-09-26 a las 13 32 40

If it helps I'm coding my project in visual studio community 2017 for Mac.

@moljac
Copy link
Member

moljac commented Sep 27, 2017

@DuarthVader
Can you provide minimal sample, please?

@DuarthVader
Copy link
Author

Yes. I'm using JsonValue parsing for GetResponseText()

captura de pantalla 2017-09-27 a las 10 24 05

@moljac
Copy link
Member

moljac commented Sep 27, 2017

@DuarthVader
Please paste this method code here. I will try to test it with my samples.

@DuarthVader
Copy link
Author

private void ClickOnFacebookBtn()
{
var auth = new OAuth2Authenticator(
clientId: FBClientId,
clientSecret: FBClientSecret,
accessTokenUrl: new Uri("https://graph.facebook.com/oauth/access_token"),
scope: "email",
authorizeUrl: new Uri("https://www.facebook.com/v2.10/dialog/oauth"),
redirectUrl: new Uri(string.Format("fb{0}://authorize", FBClientId)),
getUsernameAsync: null,
isUsingNativeUI: true
);

		auth.Completed += Facebook_Auth_Completed;
		auth.Error += Facebook_Auth_Error;

        AuthenticationState.Authenticator = auth;

		var presenter = new OAuthLoginPresenter();
		presenter.Login(auth);
    }

private async void Facebook_Auth_Completed(object sender, AuthenticatorCompletedEventArgs e)
{
using (UserDialogs.Instance.Loading("Cargando..."))
{
var authenticator = sender as OAuth2Authenticator;
if (authenticator != null)
{
authenticator.Completed -= Facebook_Auth_Completed;
authenticator.Error -= Facebook_Auth_Error;
}

			if (e.IsAuthenticated)
			{
				var request = new OAuth2Request(
					"GET",
					new Uri("https://graph.facebook.com/v2.10/me/?fields=name,picture,location,locale,link,age_range,birthday,devices,email,first_name,last_name,gender,hometown,is_verified,languages"),
					null,
					e.Account
				);

				var fbResponse = await request.GetResponseAsync();
				var fbUser = JsonValue.Parse(fbResponse.GetResponseText());
				NavigateToRegister(fbUser["name"], fbUser["email"], fbUser["id"], fbUser["first_name"], (string)fbUser["last_name"] ?? "", 0);
			}
        }
	}

private void Facebook_Auth_Error(object sender, AuthenticatorErrorEventArgs e)
{
var authenticator = sender as OAuth2Authenticator;
if (authenticator != null)
{
authenticator.Completed -= Facebook_Auth_Completed;
authenticator.Error -= Facebook_Auth_Error;
}

        Debug.WriteLine("Authentication error: " + e.Message);
	}

@SaturninoPimentel
Copy link

I have the same issue, is there a workaround? In my case I'm using the version 1.6.0.2

@newky2k newky2k added needs-info More information is requested by engineering assigned engineer and removed needs-info More information is requested by engineering labels Sep 3, 2018
@Redth Redth added this to Inbox in Triage Nov 20, 2018
@Redth
Copy link
Member

Redth commented Nov 20, 2018

This looks like a potential linker bug.

  1. With Linking set to Do Not Link, does this still occur?
  2. Have you got a reference to System.Json assembly in your project?

@Redth Redth added the needs-info More information is requested by engineering label Nov 20, 2018
@Redth Redth moved this from Inbox to Needs Info in Triage Nov 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-info More information is requested by engineering
Projects
Triage
  
Needs Info
Development

No branches or pull requests

5 participants