@@ -16,6 +16,9 @@ namespace Xamarin.Android.Build.Tests
1616 [ Category ( "UsesDevice" ) ]
1717 public class DebuggingTest : DeviceTest
1818 {
19+ const int DEBUGGER_MAX_CONNECTIONS = 100 ;
20+ const int DEBUGGER_CONNECTION_TIMEOUT = 3000 ;
21+
1922 [ TearDown ]
2023 public void ClearDebugProperties ( )
2124 {
@@ -242,7 +245,8 @@ public override void OnCreate ()
242245 int port = rnd . Next ( 10000 , 20000 ) ;
243246 TestContext . Out . WriteLine ( $ "{ port } ") ;
244247 var args = new SoftDebuggerConnectArgs ( "" , IPAddress . Loopback , port ) {
245- MaxConnectionAttempts = 2000 , // we need a long delay here to get a reliable connection
248+ MaxConnectionAttempts = DEBUGGER_MAX_CONNECTIONS , // we need a long delay here to get a reliable connection
249+ TimeBetweenConnectionAttempts = DEBUGGER_CONNECTION_TIMEOUT ,
246250 } ;
247251 var startInfo = new SoftDebuggerStartInfo ( args ) {
248252 WorkingDirectory = Path . Combine ( b . ProjectDirectory , proj . IntermediateOutputPath , "android" , "assets" ) ,
@@ -299,70 +303,87 @@ public override void OnCreate ()
299303 /* allowDeltaInstall */ false ,
300304 /* user */ null ,
301305 /* packageFormat */ "apk" ,
306+ /* useLatestSdk */ true ,
307+ } ,
308+ new object [ ] {
309+ /* embedAssemblies */ true ,
310+ /* fastDevType */ "Assemblies" ,
311+ /* allowDeltaInstall */ false ,
312+ /* user */ null ,
313+ /* packageFormat */ "apk" ,
314+ /* useLatestSdk */ false ,
302315 } ,
303316 new object [ ] {
304317 /* embedAssemblies */ false ,
305318 /* fastDevType */ "Assemblies" ,
306319 /* allowDeltaInstall */ false ,
307320 /* user */ null ,
308321 /* packageFormat */ "apk" ,
322+ /* useLatestSdk */ true ,
309323 } ,
310324 new object [ ] {
311325 /* embedAssemblies */ false ,
312326 /* fastDevType */ "Assemblies" ,
313327 /* allowDeltaInstall */ true ,
314328 /* user */ null ,
315329 /* packageFormat */ "apk" ,
330+ /* useLatestSdk */ true ,
316331 } ,
317332 new object [ ] {
318333 /* embedAssemblies */ false ,
319334 /* fastDevType */ "Assemblies:Dexes" ,
320335 /* allowDeltaInstall */ false ,
321336 /* user */ null ,
322337 /* packageFormat */ "apk" ,
338+ /* useLatestSdk */ true ,
323339 } ,
324340 new object [ ] {
325341 /* embedAssemblies */ false ,
326342 /* fastDevType */ "Assemblies:Dexes" ,
327343 /* allowDeltaInstall */ true ,
328344 /* user */ null ,
329345 /* packageFormat */ "apk" ,
346+ /* useLatestSdk */ true ,
330347 } ,
331348 new object [ ] {
332349 /* embedAssemblies */ true ,
333350 /* fastDevType */ "Assemblies" ,
334351 /* allowDeltaInstall */ false ,
335352 /* user */ DeviceTest . GuestUserName ,
336353 /* packageFormat */ "apk" ,
354+ /* useLatestSdk */ true ,
337355 } ,
338356 new object [ ] {
339357 /* embedAssemblies */ false ,
340358 /* fastDevType */ "Assemblies" ,
341359 /* allowDeltaInstall */ false ,
342360 /* user */ DeviceTest . GuestUserName ,
343361 /* packageFormat */ "apk" ,
362+ /* useLatestSdk */ true ,
344363 } ,
345364 new object [ ] {
346365 /* embedAssemblies */ true ,
347366 /* fastDevType */ "Assemblies" ,
348367 /* allowDeltaInstall */ false ,
349368 /* user */ null ,
350369 /* packageFormat */ "aab" ,
370+ /* useLatestSdk */ true ,
351371 } ,
352372 new object [ ] {
353373 /* embedAssemblies */ true ,
354374 /* fastDevType */ "Assemblies" ,
355375 /* allowDeltaInstall */ false ,
356376 /* user */ DeviceTest . GuestUserName ,
357377 /* packageFormat */ "aab" ,
378+ /* useLatestSdk */ true ,
358379 } ,
359380 } ;
360381#pragma warning restore 414
361382
362- [ Test , Category ( "Debugger" ) ]
383+ [ Test , Category ( "Debugger" ) , Category ( "WearOS" ) ]
363384 [ TestCaseSource ( nameof ( DebuggerTestCases ) ) ]
364385 [ Retry ( 5 ) ]
365- public void ApplicationRunsWithDebuggerAndBreaks ( bool embedAssemblies , string fastDevType , bool allowDeltaInstall , string username , string packageFormat )
386+ public void ApplicationRunsWithDebuggerAndBreaks ( bool embedAssemblies , string fastDevType , bool allowDeltaInstall , string username , string packageFormat , bool useLatestSdk )
366387 {
367388 AssertCommercialBuild ( ) ;
368389 SwitchUser ( ) ;
@@ -405,6 +426,9 @@ public Foo ()
405426 EmbedAssembliesIntoApk = embedAssemblies ,
406427 AndroidFastDeploymentType = fastDevType
407428 } ;
429+ if ( ! useLatestSdk ) {
430+ app . TargetFramework = "net7.0-android" ;
431+ }
408432 app . SetProperty ( "AndroidPackageFormat" , packageFormat ) ;
409433 app . MainPage = app . MainPage . Replace ( "InitializeComponent ();" , "InitializeComponent (); new Foo ();" ) ;
410434 app . AddReference ( lib ) ;
@@ -465,7 +489,8 @@ public Foo ()
465489 int port = rnd . Next ( 10000 , 20000 ) ;
466490 TestContext . Out . WriteLine ( $ "{ port } ") ;
467491 var args = new SoftDebuggerConnectArgs ( "" , IPAddress . Loopback , port ) {
468- MaxConnectionAttempts = 2000 ,
492+ MaxConnectionAttempts = DEBUGGER_MAX_CONNECTIONS ,
493+ TimeBetweenConnectionAttempts = DEBUGGER_CONNECTION_TIMEOUT ,
469494 } ;
470495 var startInfo = new SoftDebuggerStartInfo ( args ) {
471496 WorkingDirectory = Path . Combine ( appBuilder . ProjectDirectory , app . IntermediateOutputPath , "android" , "assets" ) ,
0 commit comments