首页 > 解决方案 > SpecFlowPlusRunnerAssemblyHook 抛出异常 Invalid URI: The hostname could not be parsed

问题描述

我正在将 SpecFlow 与 .net 3.1 应用程序一起使用。当我运行/调试测试时,我在一些非常深的 dll 中不断出现错误。它似乎与 ConfigurationManager 相关。

2021-11-02T09:12:27.7102541-06:00:2021-11-02T09:12:27.7100969-06:00:Assembly 解析 System.Private.Uri.resources, Version=4.0.6.0, Culture=en, PublicKeyToken= b03f5f7f11d50a3a 2021-11-02T09:12:27.7366747-06:00:2021-11-02T09:12:27.7357023-06:00:OutOfProcessTestAssemblyExecutor:RunTest 错误:System.Configuration.ConfigurationErrorsException:配置系统初始化失败---> 系统.UriFormatException:无效的 URI:无法解析主机名。在 System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) 在 System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig) 在 System.Configuration.ClientConfigPaths 在 System.Uri..ctor(String uriString)。 GetPaths(String exePath, Boolean includeUserConfig) 在 System.Configuration.ClientConfigurationHost.get_ConfigPaths() 在 System.Configuration。

另一个症状是测试被跳过。我已经调试了源代码,这似乎是一个路径问题,但我找不到有关 System.Configuration.ClientConfigurationSystem 库的任何文档。

标签: .neturispecflowconfigurationmanager

解决方案


将项目移动到较小的路径似乎是解决方法。网址中可能有一些不好的东西C:\Users\mynamee\source\repos\tfs\SomesProjMicroservices\TestAutomation\BRAN\AB.RSS.SomesProj.Microservices.TestAutomation\AB.RSS.Microservices.Common.Tests\Steps\SomereallyLongClasname


推荐阅读