Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception. System.MissingMethodException #2776

Open
CzBuCHi opened this issue Nov 23, 2023 · 15 comments
Open

Unhandled exception. System.MissingMethodException #2776

CzBuCHi opened this issue Nov 23, 2023 · 15 comments
Labels
🐛 Bug Something isn't working

Comments

@CzBuCHi
Copy link

CzBuCHi commented Nov 23, 2023

Describe the bug
when running striker via bash using dotnet stryker -O "../../StrykerOutput/$test_name" -p "$test_name.csproj" -r html -r json -r progress command (CWD is test project directory) im getting exception bellow

Logs

[18:20:06 INF] Time Elapsed 00:00:08.7951736
Unhandled exception. System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerator`1<Microsoft.CodeAnalysis.NodeStateEntry`1<System.ValueTuple`2<System.__Canon,System.__Canon>>> Microsoft.CodeAnalysis.NodeStateTable`1.GetEnumerator()'.
   at Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.GeneratorDriver.UpdateOutputs(ImmutableArray`1 outputNodes, IncrementalGeneratorOutputKind outputKind, Builder generatorRunStateBuilder, CancellationToken cancellationToken, Builder driverStateBuilder)
   at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsCore(Compilation compilation, DiagnosticBag diagnosticsBag, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsAndUpdateCompilation(Compilation compilation, Compilation& outputCompilation, ImmutableArray`1& diagnostics, CancellationToken cancellationToken)
   at Stryker.Core.Compiling.CsharpCompilingProcess.RunSourceGenerators(IAnalyzerResult analyzerResult, Compilation compilation) in /_/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs:line 116
   at Stryker.Core.Compiling.CsharpCompilingProcess.GetCSharpCompilation(IEnumerable`1 syntaxTrees) in /_/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs:line 144
   at Stryker.Core.Compiling.CsharpCompilingProcess.GetSemanticModels(IEnumerable`1 syntaxTrees) in /_/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs:line 102
   at Stryker.Core.MutationTest.CsharpMutationProcess.Mutate(MutationTestInput input) in /_/src/Stryker.Core/Stryker.Core/MutationTest/CsharpMutationProcess.cs:line 59
   at Stryker.Core.MutationTest.MutationTestProcess.Mutate() in /_/src/Stryker.Core/Stryker.Core/MutationTest/MutationTestProcess.cs:line 88
   at Stryker.Core.Initialisation.ProjectMutator.MutateProject(StrykerOptions options, MutationTestInput input, IReporter reporters) in /_/src/Stryker.Core/Stryker.Core/Initialisation/ProjectMutator.cs:line 38
   at Stryker.Core.Initialisation.ProjectOrchestrator.MutateProjects(StrykerOptions options, IReporter reporters, ITestRunner runner)+MoveNext() in /_/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs:line 68
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Stryker.Core.StrykerRunner.RunMutationTest(IStrykerInputs inputs, ILoggerFactory loggerFactory, IProjectOrchestrator projectOrchestrator) in /_/src/Stryker.Core/Stryker.Core/StrykerRunner.cs:line 61
   at Stryker.CLI.StrykerCli.RunStryker(IStrykerInputs inputs) in /_/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 93
   at Stryker.CLI.StrykerCli.<>c__DisplayClass10_0.<Run>b__0() in /_/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 68
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass143_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Stryker.CLI.StrykerCli.Run(String[] args) in /_/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs:line 74
   at Stryker.CLI.Program.Main(String[] args) in /_/src/Stryker.CLI/Stryker.CLI/Program.cs:line 14

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: Windows 11
  • Type of project: asp.net minimal api
  • Framework Version: 7.0
  • Stryker Version: 3.12.0

Additional notes
reverting back to 3.11.0 fixed my issue

@CzBuCHi CzBuCHi added the 🐛 Bug Something isn't working label Nov 23, 2023
@geeknz
Copy link

geeknz commented Nov 23, 2023

I had the same issue running with no options. I'm using 3.11.0 for now.

@dupdob
Copy link
Member

dupdob commented Nov 24, 2023

This looks like a bug with Roslyn compiler judging by the exception and by the fact that V3.12 was released to include the latest version of said libraries.

@rouke-broersma
Copy link
Member

Looks like an issue with running source generators for razor and/or minimal api

@LouisMach
Copy link

LouisMach commented Jan 8, 2024

I'm having the same issue where this error popped up running Stryker 3.13.1 with target .net 7.0.404.
Stryker 3.11 works, although some tests are failing in Stryker while they work through the CLI.

rodchenkov added a commit to GodelTech/AzureDevOps.Pipeline.Templates that referenced this issue Jan 11, 2024
@AndyCC25
Copy link

AndyCC25 commented Apr 5, 2024

Here I have the same error

[14:17:12 ERR] An error occurred during the mutation test run
System.AggregateException: One or more errors occurred. (Method not found: 'System.Collections.Generic.IEnumerator1<Microsoft.CodeAnalysis.NodeStateEntry1<System.ValueTuple2<System.__Canon,System.__Canon>>> Microsoft.CodeAnalysis.NodeStateTable1.GetEnumerator()'.)
---> System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerator1<Microsoft.CodeAnalysis.NodeStateEntry1<System.ValueTuple2<System.__Canon,System.__Canon>>> Microsoft.CodeAnalysis.NodeStateTable1.GetEnumerator()'.
at Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.GeneratorDriver.UpdateOutputs(ImmutableArray1 outputNodes, IncrementalGeneratorOutputKind outputKind, Builder generatorRunStateBuilder, CancellationToken cancellationToken, Builder driverStateBuilder)
at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsCore(Compilation compilation, DiagnosticBag diagnosticsBag, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsAndUpdateCompilation(Compilation compilation, Compilation& outputCompilation, ImmutableArray1& diagnostics, CancellationToken cancellationToken) at Stryker.Core.Compiling.CsharpCompilingProcess.RunSourceGenerators(IAnalyzerResult analyzerResult, Compilation compilation) in /_/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs:line 121 at Stryker.Core.Compiling.CsharpCompilingProcess.GetCSharpCompilation(IEnumerable1 syntaxTrees) in /_/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs:line 160
at Stryker.Core.Compiling.CsharpCompilingProcess.GetSemanticModels(IEnumerable1 syntaxTrees) in /_/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs:line 103 at Stryker.Core.MutationTest.CsharpMutationProcess.Mutate(MutationTestInput input) in /_/src/Stryker.Core/Stryker.Core/MutationTest/CsharpMutationProcess.cs:line 59 at Stryker.Core.MutationTest.MutationTestProcess.Mutate() in /_/src/Stryker.Core/Stryker.Core/MutationTest/MutationTestProcess.cs:line 88 at Stryker.Core.Initialisation.ProjectMutator.MutateProject(StrykerOptions options, MutationTestInput input, IReporter reporters) in /_/src/Stryker.Core/Stryker.Core/Initialisation/ProjectMutator.cs:line 38 at Stryker.Core.Initialisation.ProjectOrchestrator.<>c__DisplayClass7_0.<MutateProjects>b__0(MutationTestInput mutationTestInput) in /_/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs:line 70 at System.Threading.Tasks.Parallel.<>c__DisplayClass19_02.b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_02.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) at System.Threading.Tasks.TaskReplicator.Replica.Execute() --- End of inner exception stack trace --- at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction1 action, ParallelOptions options, Boolean stopOnFirstFailure)
at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt fromInclusive, TInt toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) --- End of stack trace from previous location --- at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt fromInclusive, TInt toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable1 source, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally)

Running the striker over a .NET 8 blazor with webassembly project

@dupdob
Copy link
Member

dupdob commented Apr 11, 2024

thanks for the report. Your comment led me to realize that the exception occurs while generating the semantic model for the source code. To this day, this information is hardly used by Stryker, so a quick fix could be to simply ignore the exception and move forward without the semantic model

@rouke-broersma
Copy link
Member

@dupdob at the time when this issue was opened we did not generate the semantic model. Are you referring only to the last comment?

@dupdob
Copy link
Member

dupdob commented Apr 11, 2024

It appears in all stack traces here

@rouke-broersma
Copy link
Member

I looked through the history and appears I was incorrect, we did in fact add semantic model before this issue was created. Sorry!

@dupdob
Copy link
Member

dupdob commented Apr 12, 2024

no worries. Focusing on the issue:
I just realized that we generate the semantic model before any actual compilation attempt. So there is a good chance this will happen even if we skip the semantic model generation step.
That being said, my PR from a few weeks ago may fix that. @AndyCC25, which Stryker's version are you using ?

@AndyCC25
Copy link

I'm using the version 4.0.3

@dupdob
Copy link
Member

dupdob commented Apr 14, 2024

thanks, so it contains an improvement regarding generators related settings. Which I hoped would fix all existing issues.
Clearly, it does not solve this one.

@AndyCC25
Copy link

@dupdob any news on this one, there is a plan to fix this issue?

@dupdob
Copy link
Member

dupdob commented Apr 30, 2024

hi @AndyCC25, short answer is no. As in: we do not have a clear plan on how to fix this, but we would like to fix it.
until we have a project and/or scenario to reproduce it, the best we can do is shoot in the dark (like the previous fix).
Without one, we cannot analyze what causes this: it may be that Stryker generates compilation errors that simply crashes Roslyn (while the C# compiler properly reports the syntax error), it may be that we some compilation symbols or environment variables are missing, it may be a version conflict between Razor SDK and Stryker or some other prerequisite we are not aware of.
Is there any chance you can share a small project reproducing the issue?

@AndyCC25
Copy link

AndyCC25 commented May 7, 2024

@dupdob I tried from a scratch project and didn't reproduce the issue, I'm was using blazor with web assembly mode and now in my new project there is no problems, I would probably go and check what is different in my previous project where the issue was happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants