-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address Trim warnings and prevent future regressions (#3841)
- Loading branch information
1 parent
1ecab82
commit a421af5
Showing
74 changed files
with
9,337 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule Ben.Demystifier
updated
8 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
using Sentry.Internal; | ||
|
||
namespace Sentry.Maui.Internal; | ||
|
||
internal static class PageNavigationExtensions | ||
{ | ||
private static readonly PropertyInfo? DestinationPageProperty = | ||
typeof(NavigatedFromEventArgs).GetProperty("DestinationPage", BindingFlags.Instance | BindingFlags.NonPublic); | ||
private static readonly PropertyInfo? DestinationPageProperty; | ||
private static readonly PropertyInfo? PreviousPageProperty; | ||
|
||
private static readonly PropertyInfo? PreviousPageProperty = | ||
typeof(NavigatedToEventArgs).GetProperty("PreviousPage", BindingFlags.Instance | BindingFlags.NonPublic); | ||
[UnconditionalSuppressMessage("Trimming", "IL2075: DynamicallyAccessedMembers", Justification = AotHelper.AvoidAtRuntime)] | ||
static PageNavigationExtensions() | ||
{ | ||
if (AotHelper.IsTrimmed) | ||
{ | ||
return; | ||
} | ||
DestinationPageProperty = typeof(NavigatedFromEventArgs) | ||
.GetProperty("DestinationPage", BindingFlags.Instance | BindingFlags.NonPublic); | ||
PreviousPageProperty = typeof(NavigatedToEventArgs) | ||
.GetProperty("PreviousPage", BindingFlags.Instance | BindingFlags.NonPublic); | ||
} | ||
|
||
/// <summary> | ||
/// Reads the (internal) NavigatedFromEventArgs.DestinationPage property via reflection. | ||
/// Note that this will return null if trimming is enabled. | ||
/// </summary> | ||
public static Page? GetDestinationPage(this NavigatedFromEventArgs eventArgs) => | ||
DestinationPageProperty?.GetValue(eventArgs) as Page; | ||
|
||
/// <summary> | ||
/// Reads the (internal) NavigatedFromEventArgs.PreviousPage property via reflection. | ||
/// Note that this will return null if trimming is enabled. | ||
/// </summary> | ||
public static Page? GetPreviousPage(this NavigatedToEventArgs eventArgs) => | ||
PreviousPageProperty?.GetValue(eventArgs) as Page; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.