vstest.console.exe在UWP单元测试项目中崩溃,“根级别的数据无效”。 [英] vstest.console.exe crashing on UWP unit test project with “Data at the root level is invalid.”

查看:95
本文介绍了vstest.console.exe在UWP单元测试项目中崩溃,“根级别的数据无效”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



尝试使用vstest运行UWP单元测试项目.console.exe,我使用MSBuild生成appx包,并调用:

   C:\Program Files(x86)\ Microsoft Visual Studio \\\ 2017; \\ Professional \Common7 \IDE \ Extensions \ TestPlatform> ./vstest.console.exe C:\ builds\droplocation\Uwp.UnitTesting\AppPackages\Uwp.UnitTesting_1.0.0.0_x86_Debug_Test\wp.UnitTesting_1.0.0.0_x86_Debug.appx   



但是得到:

   Microsoft(R)测试执行命令行工具版本15.5.0 
版权所有(c)Microsoft Corporation。保留所有权利。

开始测试执行,请稍候.. 。
无法启动testhost并出现错误:System.AggregateException:发生了一个或多个错误.--> Microsoft.Build.Exceptions.InvalidProjectFileException:无法加载项目文件。根级别的数据无效第1行,第1位.C:\ buildd; \\ droplocation \RS.Uwp.UnitTesting; \\ AppPackages \RS.Uwp.UnitTesting_1.0.0.0_x86_Debug_Test \RS.Uwp.UnitTesting_1.0.0.0_x86_Debug.appx - - > System.Xml.XmlException:根级别的数据无效。第1行,位置1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl .Throw(String res,String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderI mpl.Read()
at System.Xml.XmlTextReader.Read()
at Microsoft.Build.Internal.XmlReaderExtension.GetXmlReader(StreamReader input,Encoding&编码)
at Microsoft.Build.Internal.XmlReaderExtension..ctor(String file)
at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath,Boolean preserveFormatting)
--- End内部异常堆栈跟踪---
在Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(布尔条件,字符串errorSubCategoryResourceName,BuildEventFileInfo projectFile,Exception innerException,String resourceName,Object [] args)
在Microsoft。 Build.Construction.ProjectRootElement.LoadDocument(String fullPath,Boolean preserveFormatting)
at Microsoft.Build.Construction.ProjectRootElement..ctor(String path,ProjectRootElementCache projectRootElementCache,Boolean preserveFormatting)
at Microsoft.Build.Construction。 ProjectRootElement.CreateProjectFromPath(String projectFile,IDictionary`2 globalProperties,String toolsVersion,ProjectRootElementCache projectRootElementCache,Boolean preserveFormatting)
在Microsoft.Build.Construction.ProjectRootElement。<> c__DisplayClass200_0。
< OpenProjectOrSolution> b__0(String path,ProjectRootElementCache cache)
at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile,OpenProjectRootElement openProjectRootElement,Boolean isExplicitlyLoaded,Nullable`1 preserveFormatting)
at Microsoft。 Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath,IDictionary`2 globalProperties,String toolsVersion,ProjectRootElementCache projectRootElementCache,Boolean isExplicitlyLoaded)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName,IDictionary`2 globalProperties,String toolsVersion在Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_LayoutPath在Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_Project)
()
()
。在Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio。 UwpTestHostRuntimeProvider.IDeployer.Deploy()
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Uwp TestHostManager。
< LaunchHostAsync> d__35.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的
(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager。
< Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync> d__30.MoveNext()
---内部异常堆栈跟踪结束---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager。 SetupChannel(IEnumerable`1 sources,CancellationToken cancellationToken)
--->(内部异常#0)Microsoft.Build.Exceptions.InvalidProjectFileException:无法加载项目文件。根级别的数据无效。 1,位置1. C:\ buildd; \\ droplocation \RS.Uwp.UnitTesting; \\ AppPackages\RS.Uwp.UnitTesting_1.0.0.0_x86_Debug_Test\RS.Uwp.UnitTesting_1.0.0.0_x86_Debug.appx --- > System.Xml.XmlException:根级别的数据无效。第1行,位置1.
在System.Xml.XmlTextReaderImpl.Throw(例外e)
at System.Xml.XmlTextReaderImpl.Throw(String res,String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml System.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at Microsoft.Build.Internal.XmlReaderExtension.GetXmlReader(StreamReader input,Encoding&编码)
at Microsoft.Build.Internal.XmlReaderExtension..ctor(String file)
at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath,Boolean preserveFormatting)
--- End内部异常堆栈跟踪---
在Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(布尔条件,字符串errorSubCategoryResourceName,BuildEventFileInfo projectFile,Exception innerException,String resourceName,Object [] args)
在Microsoft。 Build.Construction.ProjectRootElement.LoadDocument(String fullPath,Boolean preserveFormatting)
at Microsoft.Build.Construction.ProjectRootElement..ctor(String path,ProjectRootElementCache projectRootElementCache,Boolean preserveFormatting)
at Microsoft.Build.Construction。 ProjectRootElement.CreateProjectFromPath(String projectFile,IDictionary`2 globalProperties,String toolsVersion,ProjectRootElementCache projectRootElementCache,Boolean preserveFormatting)
在Microsoft.Build.Construction.ProjectRootElement。<> c__DisplayClass200_0。
< OpenProjectOrSolution> b__0(String path,ProjectRootElementCache cache)
at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile,OpenProjectRootElement openProjectRootElement,Boolean isExplicitlyLoaded,Nullable`1 preserveFormatting)
at Microsoft。 Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath,IDictionary`2 globalProperties,String toolsVersion,ProjectRootElementCache projectRootElementCache,Boolean isExplicitlyLoaded)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName,IDictionary`2 globalProperties,String toolsVersion在Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_LayoutPath在Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_Project)
()
()
。在Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio。 UwpTestHostRuntimeProvider.IDeployer.Deploy()
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Uwp TestHostManager。
< LaunchHostAsync> d__35.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的
(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager。
< Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync> d__30.MoveNext()< ---


测试运行中止。





当我更改  vstest.console.exe   location
from:

   C:\Program Files(x86)\ Microsoft Visual Studio\2017 \Professional\Common7\IDE\Extensions\TestPlatform   



to:

   C:\Program Files(x86)\ Microsoft Visual Studio \ 2017 \Professional \ Common7 \IDE \CommonExtensions\Microsoft\TestWindow   



它在我的本地机器上运行VS2017 Professional,但是当在删除构建服务器上使用构建代理调用时,它仍然是相同的:

   ************ ********************************** 
开始:VsTest - UWP
*** ************************************************** *************************
===================== ================================================== =======
任务:Visual Studio测试
描述:使用Visual Studio测试运行器运行测试
版本:2.3.8
作者:Microsoft Corporation
帮助:[更多信息](https://go.microsoft.com/fwlink/?LinkId=835764)
====================== ================================================== ======
使用vstest.console.exe在本地运行测试
========================== ==============================
测试选择器:测试程序集
测试程序集:C:\ agent \_work\2\a\AppxPackages\Uwp.UnitTesting_1.0.0.0_x86_Test\Uwp.UnitTesting_1.0.0.0_x86.appx
测试过滤条件:null
搜索文件夹:C :\ag ent\_work\2\s
运行设置文件:C:\agent \_work \\\
并行运行:false
单独运行:true
自定义适配器的路径:null
其他控制台选项:null
启用代码覆盖:false
重新运行失败测试:false
vstest.console.exe,指定位置: C:\Program Files(x86)\ Microsoft Visual Studio \\\ 2017 \ Communmunity \ Common7 \IDE \CommonExtensions \ Microsoft &\\TestWindow
=========== =============================================
" ; C:\Program Files(x86)\ Microsoft Visual Studio \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ @C:\\\ tnton \_work \ _temp \ 635f6641-039f-11e8-b3d5-d35598e183b1.txt
Microsoft(R)测试执行命令行工具版本15.5.0
版权所有(c)微软公司。版权所有。
vstest.console.exe
" C:\\\ tntant \_work \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ .appx"
/ InIsolation
/ logger:" trx"
/ TestAdapterPath:"C:\\\\\\\\
开始测试执行,请稍候...
无法启动testhost并出现错误:System.AggregateException:发生一个或多个错误。 ---> Microsoft.Build.Exceptions.InvalidProjectFileException:无法加载项目文件。根级别的数据无效。第1行,位置1. C:\\\ tnt \_work \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ System.Xml.XmlException:根级别的数据无效。第1行,位置1.
在System.Xml.XmlTextReaderImpl.Throw(例外e)



解决方案

嗨Alek Kowalczyk2,


欢迎来到MSDN论坛。


我可以使用Visual Studio Enterprise 2017 v15.5.4在本地重新解决您的问题。


如果我使用vstest.console。 exe位于此处" C:\Program Files(x86)\ Microsoft Visual Studio \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ / EM>
运行单元测试应用程序(通用Windows)项目,我的测试运行中止了。


如果我使用位于此处的vstest.console.exe" C:\Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Communmunity \ Common7 \IDE \ CommonExtensions\Microsoft\TestWindow\vstest.console.exe "
运行单元测试应用程序(通用Windows)项目,我的测试运行好吧。




我认为这是vstest.console.exe的限制,你可以提交用户语音到VS连接
https://visualstudio.uservoice.com/forums/121579-visual-studio
,来自MS的工程师将认真评估这个问题。


>>

它可以在我的本地机器上运行VS2017 Professional,但是当在删除构建服务器上使用构建代理调用它时,它仍然是相同的:


你是如何在删除构建服务器上使用构建代理运行测试的?


Stack Overflow 并在你的线程中添加一个带有TFS的标签,然后你会得到TFS成员的支持。由于TFS论坛已被锁定,TFS的讨论已经移动。


>>奇怪的是,当我尝试在构建服务器上手动运行它时,它崩溃了以下输出:


你是否运行与本地相同的项目?运行新项目时的结果怎么样?


如果新项目工作正常,则表明问题是由项目引起的。请尝试将项目从本地重新复制到构建服务器。


你是如何在构建服务器上手动运行测试的?你是否使用vstest.console.exe命令行或在Visual Studio中使用测试资源管理器?


如果它在Test Explorer中工作正常,那么你可以使用命令行再次运行它。


如果它在测试资源管理器中运行失败,则表明测试环境导致了问题。请检查并配置测试环境。


< span style ="color:#666666;行高:107%; font-family:'Segoe UI',sans-serif; font-size:10pt">问候,


Judyzh


Trying to run a UWP unit test project using vstest.console.exe, I generate the appx package using MSBuild, and call:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform> ./vstest.console.exe C:\builds\droplocation\Uwp.UnitTesting\AppPackages\Uwp.UnitTesting_1.0.0.0_x86_Debug_Test\wp.UnitTesting_1.0.0.0_x86_Debug.appx

But getting:

Microsoft (R) Test Execution Command Line Tool Version 15.5.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Failed to launch testhost with error: System.AggregateException: One or more errors occurred. ---> Microsoft.Build.Exceptions.InvalidProjectFileException: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.  C:\builds\droplocation\RS.Uwp.UnitTesting\AppPackages\RS.Uwp.UnitTesting_1.0.0.0_x86_Debug_Test\RS.Uwp.UnitTesting_1.0.0.0_x86_Debug.appx ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at Microsoft.Build.Internal.XmlReaderExtension.GetXmlReader(StreamReader input, Encoding& encoding)
   at Microsoft.Build.Internal.XmlReaderExtension..ctor(String file)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting)
   --- End of inner exception stack trace ---
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCache projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCache projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.<>c__DisplayClass200_0.<OpenProjectOrSolution>b__0(String path, ProjectRootElementCache cache)
   at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCache projectRootElementCache, Boolean isExplicitlyLoaded)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_Project()
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_LayoutPath()
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio.UwpTestHostRuntimeProvider.IDeployer.Deploy()
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<LaunchHostAsync>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync>d__30.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
---> (Inner Exception #0) Microsoft.Build.Exceptions.InvalidProjectFileException: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.  C:\builds\droplocation\RS.Uwp.UnitTesting\AppPackages\RS.Uwp.UnitTesting_1.0.0.0_x86_Debug_Test\RS.Uwp.UnitTesting_1.0.0.0_x86_Debug.appx ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at Microsoft.Build.Internal.XmlReaderExtension.GetXmlReader(StreamReader input, Encoding& encoding)
   at Microsoft.Build.Internal.XmlReaderExtension..ctor(String file)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting)
   --- End of inner exception stack trace ---
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCache projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCache projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.<>c__DisplayClass200_0.<OpenProjectOrSolution>b__0(String path, ProjectRootElementCache cache)
   at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCache projectRootElementCache, Boolean isExplicitlyLoaded)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_Project()
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.RecipeFile.get_LayoutPath()
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio.UwpTestHostRuntimeProvider.IDeployer.Deploy()
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<LaunchHostAsync>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync>d__30.MoveNext()<---


Test Run Aborted.

When I change the vstest.console.exe location from:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform

to:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow

It works on my local machine with VS2017 Professional, but when called with the build agent on the remove build server, it's still the same:

******************************************************************************
Starting: VsTest - UWP
******************************************************************************
==============================================================================
Task         : Visual Studio Test
Description  : Run tests with Visual Studio test runner
Version      : 2.3.8
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=835764)
==============================================================================
Run the tests locally using vstest.console.exe
========================================================
Test selector : Test assemblies
Test assemblies : C:\agent\_work\2\a\AppxPackages\Uwp.UnitTesting_1.0.0.0_x86_Test\Uwp.UnitTesting_1.0.0.0_x86.appx
Test filter criteria : null
Search folder : C:\agent\_work\2\s
Run settings file : C:\agent\_work\2\s
Run in parallel : false
Run in isolation : true
Path to custom adapters : null
Other console options : null
Code coverage enabled : false
Rerun failed tests: false
vstest.console.exe, specified location : C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
========================================================
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" @C:\agent\_work\_temp\635f6641-039f-11e8-b3d5-d35598e183b1.txt
Microsoft (R) Test Execution Command Line Tool Version 15.5.0
Copyright (c) Microsoft Corporation.  All rights reserved.
vstest.console.exe 
"C:\agent\_work\2\a\AppxPackages\Uwp.UnitTesting_1.0.0.0_x86_Test\Uwp.UnitTesting_1.0.0.0_x86.appx"
/InIsolation
/logger:"trx"
/TestAdapterPath:"C:\agent\_work\2\s"
Starting test execution, please wait...
Failed to launch testhost with error: System.AggregateException: One or more errors occurred. ---> Microsoft.Build.Exceptions.InvalidProjectFileException: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.  C:\agent\_work\2\a\AppxPackages\Uwp.UnitTesting_1.0.0.0_x86_Test\Uwp.UnitTesting_1.0.0.0_x86.appx ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)


解决方案

Hi Alek Kowalczyk2,

Welcome to the MSDN forum.

I could repro your issue in my side in local with Visual Studio Enterprise 2017 v15.5.4.

If I use vstest.console.exe located here "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" to run Unit Test App (Universal Windows) project, my test run aborted as yours.

If I use vstest.console.exe located here "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" to run Unit Test App (Universal Windows) project, my test run well.

I think it’s a limit of vstest.console.exe, you could submit a User Voice to VS connect https://visualstudio.uservoice.com/forums/121579-visual-studio , engineers from the MS will evaluate this issue seriously.

>> It works on my local machine with VS2017 Professional, but when called with the build agent on the remove build server, it's still the same:

How did you run your test with build agent on the remove build server?

Do you run your test use test task in TFS build? If yes, I suggest you could post your issue in Stack Overflow and add a tag with TFS in your thread, then you would get support from TFS members. Since the TFS forums have been locked, the discussion for TFS has moved.

>> What's strange, when I try to run it manually on the build server, it crashes with following output:

Do you run the same project as local? How about the result when you run with new project?

If it works fine with the new project, this indicates that the problem is caused by the project. Please try to re-copy the project from local to build server.

How did you run your test manually on the build server? Do you use vstest.console.exe command line or use Test Explorer in Visual Studio?

If it works fine with Test Explorer, then you could use command line to run it again.

If it run fails with Test Explorer, this indicates that the test environment is causing the problem. Please check and configurate the test environment.

Regards,

Judyzh


这篇关于vstest.console.exe在UWP单元测试项目中崩溃,“根级别的数据无效”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆