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

Analyzer 'WpfAnalyzers.ClrPropertyDeclarationAnalyzer' threw an exception of type 'System.ArgumentOutOfRangeException' with message 'Specified argument was out of the range of valid values. #291

Closed
weisangwtg opened this issue Nov 20, 2020 · 2 comments

Comments

@weisangwtg
Copy link

weisangwtg commented Nov 20, 2020

I got these errors when updated to WpfAnalyzers (3.5.1) recently.

1>CSC : error AD0001: Analyzer 'WpfAnalyzers.ClrPropertyDeclarationAnalyzer' threw an exception of type 'System.ArgumentOutOfRangeException' with message 'Specified argument was out of the range of valid values.
1>  Parameter name: index'.
1>  Exception occurred with following context:
1>  Compilation: CargoWise.Glow.UI.Infrastructure
1>  SyntaxTree: D:\Validation\ModelValidationResult.cs
1>  SyntaxNode: public bool IsAcknowledged { get ... [PropertyDeclarationSyntax]@[2243..2317) (80,2)-(84,3)
1>  System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
1>  Parameter name: index
1>  at Microsoft.CodeAnalysis.SyntaxList`1.get_Item(Int32 index)
1>  at WpfAnalyzers.DependencyObject.SetCurrentValue.Find(MethodOrAccessor node, SemanticModel semanticModel, CancellationToken cancellationToken)
1>  at WpfAnalyzers.ClrPropertyDeclarationAnalyzer.Handle(SyntaxNodeAnalysisContext context)
1>  at WpfAnalyzers.ClrPropertyDeclarationAnalyzer.<>c.<Initialize>b__3_0(SyntaxNodeAnalysisContext x)
1>  at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__58`1.<ExecuteSyntaxNodeAction>b__58_0(ValueTuple`2 data)
1>  at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
1>  -----
1>  Suppress the following diagnostics to disable this analyzer: WPF0003, WPF0012, WPF0032, WPF0035, WPF0036

related code:

		public bool IsAcknowledged
		{
			get { return false; }
			set { }
		}
2>CSC : error AD0001: Analyzer 'WpfAnalyzers.ClrMethodDeclarationAnalyzer' threw an exception of type 'System.ArgumentOutOfRangeException' with message 'Specified argument was out of the range of valid values.
2>  Parameter name: index'.
2>  Exception occurred with following context:
2>  Compilation: CargoWise.Glow.UI.Controls
2>  SyntaxTree: D:\Accordion\Accordion.cs
2>  SyntaxNode: static void OnAccordionButtonStylePropertyChanged ... [MethodDeclarationSyntax]@[23118..23235) (664,2)-(666,3)
2>  System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
2>  Parameter name: index
2>  at Microsoft.CodeAnalysis.SyntaxList`1.get_Item(Int32 index)
2>  at WpfAnalyzers.DependencyObject.SetValue.Find(MethodOrAccessor node, SemanticModel semanticModel, CancellationToken cancellationToken)
2>  at WpfAnalyzers.SetAttached.Match(MethodDeclarationSyntax method, SemanticModel semanticModel, CancellationToken cancellationToken)
2>  at WpfAnalyzers.ClrMethodDeclarationAnalyzer.Handle(SyntaxNodeAnalysisContext context)
2>  at WpfAnalyzers.ClrMethodDeclarationAnalyzer.<>c.<Initialize>b__3_0(SyntaxNodeAnalysisContext x)
2>  at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__58`1.<ExecuteSyntaxNodeAction>b__58_0(ValueTuple`2 data)
2>  at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
2>  -----
2>  Suppress the following diagnostics to disable this analyzer: WPF0004, WPF0013, WPF0033, WPF0034, WPF0042, WPF0061

related code:

		public static readonly DependencyProperty AccordionButtonStyleProperty =
			DependencyProperty.Register(
				nameof(AccordionButtonStyle),
				typeof(Style),
				typeof(Accordion),
				new PropertyMetadata(null, OnAccordionButtonStylePropertyChanged));
@JohanLarsson
Copy link
Collaborator

JohanLarsson commented Nov 20, 2020

Thank you for reporting!
Sorry about the bug.
Sneaky setter 😉

@JohanLarsson
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants