Testura / Testura.Mutation

Mutation testing tool for C# .NET
MIT License
105 stars 6 forks source link

InvalidOperationException: Cannot modify an evaluated object originating in an imported file #11

Closed CrispyDrone closed 4 years ago

CrispyDrone commented 5 years ago

Hello,

I was trying out Unima on the CsvHelper's Test projects ( https://github.com/JoshClose/CsvHelper ) but bumped into the issue described in the title.

Sorry if this is something obvious I'm missing

Here is the contents of the log file:

2019-06-08 16:14:38,467: Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler: Opening project at C:\Users\Eigenaar\Desktop\Test.json
2019-06-08 16:14:38,493: Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler: Loading configuration: {
    "SolutionPath": "C:\\Users\\Eigenaar\\Desktop\\Computer Science\\Projects\\CsvHelper\\src\\CsvHelper.sln",
    "TestProjects": [
        "CsvHelper(netstandard2.0)",
        "CsvHelper(net45)",
        "CsvHelper.Tests",
        "CsvHelper.Performance"
    ],
    "IgnoredProjects": [],
    "Filter": null,
    "NumberOfTestRunInstances": 3,
    "BuildConfiguration": "debug",
    "MaxTestTimeMin": 5,
    "TestRunner": "DotNet",
    "DotNetPath": null,
    "MutationRunLoggers": null,
    "Mutators": []
}

2019-06-08 16:14:38,670: Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler: Loading mutators..
2019-06-08 16:14:38,671: Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler: ..did not find any mutators in config so loading default ones.
2019-06-08 16:14:39,658: Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler: Opening solution..
2019-06-08 16:19:26,727: Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler: Failed to open project
System.InvalidOperationException: Cannot modify an evaluated object originating in an imported file "C:\Users\Eigenaar\.nuget\packages\msbuild.sdk.extras\2.0.0-preview.14\Build\Inference.targets".
   bij Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
   bij Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0)
   bij Microsoft.Build.Evaluation.Project.VerifyThrowInvalidOperationNotImported(ProjectRootElement otherXml)
   bij Microsoft.Build.Evaluation.Project.RemoveProperty(ProjectProperty property)
   bij Microsoft.CodeAnalysis.MSBuild.ProjectFile.<GetProjectFileInfosAsync>d__16.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.<DoOperationAndReportProgressAsync>d__17`1.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.<LoadProjectFileInfosAsync>d__19.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.<LoadProjectInfosFromPathAsync>d__20.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.<LoadAsync>d__18.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.<LoadSolutionInfoAsync>d__22.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.<OpenSolutionAsync>d__23.MoveNext()
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
   bij System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bij System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   bij Unima.Application.Commands.Project.OpenProject.OpenProjectCommandHandler.<Handle>d__2.MoveNext() in C:\Users\Eigenaar\Desktop\Computer Science\Projects\Unima\src\Unima.Application\Commands\Project\OpenProject\OpenProjectCommandHandler.cs:regel 68
MilleBo commented 5 years ago

Hey!

Your configuration seems fine so no problem with that.

But it seems like Roslyn crash when it try to open your solution (it don't even show up as diagnostic errors so it's a hard crash). So I googled around to see if there are a quick fix for your project and I tried a couple of things:

I then tried to look into Roslyn and found an old issue on this and msbuild.sdk.extras:

https://github.com/dotnet/roslyn/issues/31011

Last answer is from 13 Mar and it suggest to fork out to repo and build with my own fix so maybe I will try that later. But it's a very specific fix and it would only fix your project which is kind of a bummer.

CrispyDrone commented 5 years ago

Hi

Thank you for your response. Yes that's unfortunate. I will give Unima a try on another project for now.

If you don't mind my asking, how can you be sure it will only be a fix for this project in particular? Is msbuild.sdk.extras very rare? If I look at the nuget package, it seems to have 400 000 downloads so this issue might prop up with other projects that depend on msbuild.sdk.extras?

MilleBo commented 5 years ago

What I mean is that it's a fix in your project and not in Unima. So even if I forked it, created a dll and added it to your project I would still have to do the same with all other projects.