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

Object reference not set to an instance of an object. (Roslyn based fork) #14

Open
michaelm7456 opened this issue Aug 14, 2020 · 0 comments

Comments

@michaelm7456
Copy link

michaelm7456 commented Aug 14, 2020

Hi all,

Reporting an issue I've ran into on the Roslyn based fork of this Repository here created by @vojtechkacmarik.

When creating a new 'Blazor' app then trying to open the Startup.cs file I get a 'NullReferenceException', possibly due to the way the Extension calculates Constructor complexity and hits an issue where a Constructor uses Expression Body syntax.

[Screenshot]
Code Metrics 'NullException'  in 'Startup' Class

[Error Log]
System.NullReferenceException: Object reference not set to an instance of an object. at CodeMetrics.Parsing.Roslyn.ConstructorExtractor.Convert(ConstructorDeclarationSyntax constructorDeclarationSyntax) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()&#x000D;&#x000A; at System.Linq.Enumerable.&lt;SelectManyIterator&gt;d__172.MoveNext() at System.Linq.Enumerable.<OfTypeIterator>d__951.MoveNext()&#x000D;&#x000A; at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)&#x000D;&#x000A; at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector) at CodeMetrics.Adornments.MetricsAdornment.Init(ITextSnapshot textSnapshot) at CodeMetrics.Adornments.MetricsAdornment..ctor(IWpfTextView view, IMethodsExtractor methodsExtractor, ICyclomaticComplexityCalculator cyclomaticComplexityCalculator) at CodeMetrics.Adornments.MeticsAdornmentFactory.TextViewCreated(IWpfTextView textView) at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.<>c__DisplayClass257_0.<BindContentTypeSpecificAssets>b__1() at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

The affected area seems to be the 'ConstructorExtractor.Convert' method.

Many thanks!

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

No branches or pull requests

1 participant