System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Xml.XmlException: 'Text' is an invalid XmlNodeType RRS feed

  • Question

  • I have MSTest Project and have some runsetting files residing to myProject diretory rather Solution Directory as below


    --- AutomationProject

    Whenever I compile and run a test I do get below error in details.

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Xml.XmlException: 'Text' is an invalid XmlNodeType. Line 14, position 17.
       at System.Xml.XmlReader.ReadEndElement()
       at Microsoft.VisualStudio.TestPlatform.ObjectModel.RunConfiguration.FromXml(XmlReader reader)
       at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetNodeValue[T](String settingsXml, String nodeName, Func`2 nodeParser)
       at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetRunConfigurationNode(String settingsXml)
       at Microsoft.VisualStudio.TestWindow.Controller.TestPlatformProvider.ShouldEnableTestPlatformV2(String runSettings)
       at Microsoft.VisualStudio.TestWindow.Controller.TestPlatformProvider.GetTestPlatformBySettings(ITestExecutorLauncher testExecutorLauncher, String testRunSettings, Boolean isAppContainer, Boolean useSpecifiedAdapterLocations, Boolean areAllTestContainersCSharpOrVBOnly)
       at Microsoft.VisualStudio.TestWindow.Controller.TestRunRequest.StartParentTestRunRequest(TestRunCriteria criteriaBasedOn)
       at Microsoft.VisualStudio.TestWindow.Controller.TestRunRequest.<CreateRequests>d__24.MoveNext()
       at Microsoft.VisualStudio.TestWindow.Controller.Request.<RunRequests>d__95.MoveNext()
       --- End of inner exception stack trace ---
       at Microsoft.VisualStudio.TestWindow.Controller.Request.<ProcessRequest>d__94.MoveNext()

    If I Do associate RunSettings file from Solution Folder I am able to run Test successfully.

    Please help me in understanding what is going wrong here

    Thank you


    Friday, January 25, 2019 5:51 AM

All replies

  • Hi friend,

    Welcome to MSDN forum.

    Do you run the test with VS IDE only or with TFS or VSTS? And what’s your vs version you use?

    I create the directory similar to you, but it works well with vs2017 locally. And directory architecture is below:

    So if you use VS IDE only:

    1.Make sure the test can run normally if it locates in solution  folder.

    2.Every time after we move the settings file, please reselect the file by Test=>Select Test settings file.

    3.order: Rebuild the solution=>select test setting file=> then run the test.

    And check if it solve this issue, if not, could you please share more info (vs version, a sample runsettings file). So that we can reproduce the same issue and solve it.

    And if you use TFS , VSTS:

    Please run the tests locally to check if it works well. If it can’t work locally with VS only, we may need detailed info about the error message to reproduce it.

    And if it works well in vs locally and gets such issue with TFS, please let me know.

    Please feel free to contact us If there has any update. Look forward to your reply!

    Best regards


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 28, 2019 10:43 AM