microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

[BUG] CopeCop error - Rule139DoNotAssignToStringWithSmallerCapacity #4682

Closed fvet closed 5 years ago

fvet commented 5 years ago

Describe the bug

The CodeCop analyzer often results in following error:

Analyzer 'Microsoft.Dynamics.Nav.CodeCop.Design.Rule139DoNotAssignToStringWithSmallerCapacity' threw an exception of type 'System.NullReferenceException' with message 'System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Dynamics.Nav.CodeCop.Design.Rule139DoNotAssignToStringWithSmallerCapacity.CalculateStrSubstNoMethodResultLength(IInvocationExpression invocation, Boolean& isError) in C:\a\998\s\source\Prod\Microsoft.Dynamics.Nav.CodeCop\Design\Rule139DoNotAssignToStringWithSmallerCapacity.cs:line 279 at Microsoft.Dynamics.Nav.CodeCop.Design.Rule139DoNotAssignToStringWithSmallerCapacity.CalculateMaxExpressionLength(IOperation expression, Boolean& isError) in C:\a\998\s\source\Prod\Microsoft.Dynamics.Nav.CodeCop\Design\Rule139DoNotAssignToStringWithSmallerCapacity.cs:line 176 at Microsoft.Dynamics.Nav.CodeCop.Design.Rule139DoNotAssignToStringWithSmallerCapacity.AnalyzeConversion(OperationAnalysisContext ctx) in C:\a\998\s\source\Prod\Microsoft.Dynamics.Nav.CodeCop\Design\Rule139DoNotAssignToStringWithSmallerCapacity.cs:line 48 at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass53_1.b__1() in C:\a\998\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 766 at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info) in C:\a\998\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 1080'

To Reproduce

Using AL vsix from Partner Preview 04

image

qutreson commented 5 years ago

@fvet, this looks like a duplicate of #4422. It should have been fixed in the latest AL extension from the marketplace. Can you verify that the issue does not reproduce anymore?

PooyaKharamesh commented 5 years ago

I am closing this issue because it appears that it has been resolved. Please open a new issue if you believe this has not been resolved and reference the current issue.