Bug description
Analyzer UNT0038 throws AD0001
- Version of analyzers assembly: Microsoft Visual Studio\18\Professional\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll Version 18.5.1.0
- Analyzer rule: UNT0038
- Error (exception message, type, and callstack where applicable):
Analyzer 'Microsoft.Unity.Analyzers.CacheYieldInstructionAnalyzerAnalyzer' threw an exception of type 'System.InvalidOperationException' with message 'Sequence contains more than one matching element'.
Exception occurred with following context:
Compilation: Overdrive.PBPlus.Editor
SyntaxTree: D:\Programme\Installiert\UnityProjects\RetroFPS\Packages\com.overdrive.pbplus\Editor\Scripts\Core\PBPlusModeProvider.cs
SyntaxNode: yield return new A(23, 23); [YieldStatementSyntax]@[329..356) (17,8)-(17,35)
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.Unity.Analyzers.CacheYieldInstructionAnalyzerAnalyzer.AnalyzeYieldReturn(SyntaxNodeAnalysisContext context)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
-----
Suppress the following diagnostics to disable this analyzer: UNT0038
Code that can cause it:
Happens if ctor has 2 or more parameters. Guess the Unity WaitForSeconds call has one so the analyzer isn't made to deal with more.
public struct A
{
public A(int a, int b)
{
}
public static IEnumerable<A> GetObjs()
{
yield return new A(23, 23); // <- here
}
}
Bug description
Analyzer UNT0038 throws AD0001
Code that can cause it:
Happens if ctor has 2 or more parameters. Guess the Unity WaitForSeconds call has one so the analyzer isn't made to deal with more.