-
Notifications
You must be signed in to change notification settings - Fork 347
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
Linker #1590
Linker #1590
Conversation
@@ -4,6 +4,12 @@ | |||
using System; | |||
using System.Reflection; | |||
using System.Runtime.InteropServices; | |||
#if ANDROID_BUILDTIME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use if ANDROID
as we not hiding anything here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably the reason why the fix isn't working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tried doing this with #if ANDROID but that did not seem to work. The only thing that did work was adding preserve to each of the classes. We can remove this from the AssemblyInfo
Context: the linker works by removing code that isn't used by your app. For example, if the customer uses the system webview, then all the code related to embedded webview will be removed. The root cause for json exceptions:
So the solution is either:
If we want to play nice with Xamarin, we should go with [Preserve] attributes. This will allow Xamarin to remove unused code form MSAL and produce a smaller apk. If we want to be more future proof, [assembly: LinkerSafe] is the answer - this will tell Xamarin to leave MSAL alone and if we add a new object that we deserialize, then we wouldn't have to add the [Preseve] attribute as well. But the size of APK will be larger, and customers may complain. |
…fdef for iOS/Android
LGTM |
@@ -280,10 +280,12 @@ public void VerifyResult(ITestController controller) | |||
} | |||
else if (result.Contains(CoreUiTestConstants.TestResultFailureMessage)) | |||
{ | |||
controller.Tap("LogPage"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need all those else
clauses because you are either returning or throwing, which breaks the flow anyway.
I would not use something like:
Instead declare a PreserveAttribute class and use that in the code:
Then you can use it like:
This is a much cleaner solution. |
@@ -311,7 +311,13 @@ private void CreateExceptionMessage(Exception exception) | |||
acquireResponseLabel.Text = "Exception - " + exception.Message; | |||
} | |||
|
|||
Console.WriteLine(exception); | |||
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Exception -\nMessage: {0}\nStack Trace: {1}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you just replace the entire block with
Console.WriteLine(exception);
it will be enough. The exception.ToString() method takes care of outputting the message, the stack trace and the inner exception details
80abc68
to
d61c851
Compare
* Checking response code to determine it we should invoke broker * Better handling for broker responses
tracking bug: #1586
Things that don't work now: json exception.