【问题标题】:System.Net.Http.HttpRequestException exception will running th xamarin UI Test on Physical DeviceSystem.Net.Http.HttpRequestException 异常将在物理设备上运行 xamarin UI 测试
【发布时间】:2016-10-22 05:46:55
【问题描述】:

我创建了一个简单的 Xamarin.Forms(Portable) 项目并在其中包含 UI 测试项目。但是当我尝试在物理设备中运行测试时,它给了我下面提到的异常。

Test Name:  AppLaunches
Test Outcome:   Failed
Result Message: 
SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request.
  ----> System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly.
Result StandardOutput:  Full log file: C:\Users\Admin\AppData\Local\Temp\uitest\log-2016-10-22_11-04-53-698.txt
Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Android test running Xamarin.UITest version: 2.0.0.1534
Initializing Android app on device ZX1D63GCCL with installed app: co.veloxcore.UITestSample2
Signing apk with Xamarin keystore.
Skipping installation: Already installed.

这是我的项目的链接:XamarinUITest 日志文件:Error Log

【问题讨论】:

标签: xamarin xamarin.android xamarin.forms ui-testing xamarin.uitest


【解决方案1】:

您是否使用ModernHttpClient? 如果您想处理网络异常,也可以使用Polly。 例如:

conferences = await Policy  
      .Handle<WebException>()
      .WaitAndRetry
      (
        retryCount:5, 
        sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
      )
      .ExecuteAsync(async () => await getConferencesTask);

AsyncErrorHandler 也是处理异步异常的好工具

【讨论】:

  • 这些是来自 Xamarin UITest 管道的异常。我有同样的问题。我认为无法将此答案应用于该问题。
猜你喜欢
  • 2016-01-29
  • 2021-01-26
  • 1970-01-01
  • 2021-05-11
  • 2016-03-20
  • 2019-04-03
  • 2019-05-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多