File tree Expand file tree Collapse file tree 4 files changed +277
-23
lines changed Expand file tree Collapse file tree 4 files changed +277
-23
lines changed Original file line number Diff line number Diff line change 44// int.Parse(), int.ToString()
55// Culture-aware string comparisons
66// ResourceManager
7+ // System.Reflection
78// System.Threading.Tasks.Task
89// System.Net.Http.HttpClient
910
1011// Opt out of this warning, because we actually *want* culture-aware string behavior in the AOT profile
1112#pragma warning disable CA1310
1213
14+ using System . Reflection ;
15+
1316static class CommonMethods
1417{
1518 // Returns '200 OK' if the caller wants to set that on the UI
@@ -26,6 +29,10 @@ public static async Task<string> Invoke()
2629
2730 string someString = AndroidProfiledAot . Resources . Strings . SomeString ;
2831
32+ var type = typeof ( CommonMethods ) ;
33+ var method = type . GetMethod ( nameof ( FromReflection ) , BindingFlags . NonPublic | BindingFlags . Static ) ;
34+ method . Invoke ( null , null ) ;
35+
2936 using var client = new HttpClient ( ) ;
3037 var send = client . SendAsync ( new HttpRequestMessage ( HttpMethod . Get , url ) ) ;
3138 var getstring = client . GetStringAsync ( url ) ;
@@ -34,6 +41,8 @@ public static async Task<string> Invoke()
3441
3542 return text ;
3643 }
44+
45+ static void FromReflection ( ) { }
3746}
3847
3948#pragma warning restore CA1310
Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ namespace android;
33[ Activity ( Label = "@string/app_name" , MainLauncher = true ) ]
44public class MainActivity : Activity
55{
6- protected override void OnCreate ( Bundle ? savedInstanceState )
6+ protected async override void OnCreate ( Bundle ? savedInstanceState )
77 {
88 base . OnCreate ( savedInstanceState ) ;
99
10- _ = CommonMethods . Invoke ( ) ;
11-
1210 // Set our view from the "main" layout resource
1311 SetContentView ( Resource . Layout . activity_main ) ;
12+
13+ await CommonMethods . Invoke ( ) ;
1414 }
1515}
You can’t perform that action at this time.
0 commit comments