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

Fix StringFormatValidator NRE due to array instantiation w/o initializer #2392

Closed
andrei-epure-sonarsource opened this issue Apr 17, 2019 · 0 comments · Fixed by #2398
Closed
Assignees
Labels
Area: C# C# rules related issues. Type: Bug Exceptions and blocking issues during analysis.
Milestone

Comments

@andrei-epure-sonarsource
Copy link
Contributor

andrei-epure-sonarsource commented Apr 17, 2019

Description

CSC : error AD0001: Analyzer 'SonarAnalyzer.Rules.CSharp.StringFormatValidator' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. [C:\Project\src\Plugins\SmartStore.PayPal\SmartStore.PayPal.csproj]

Repro steps

  • git clone clone https://github.com/smartstore/SmartStoreNET.git

  • git checkout 3.1.5

  • SonarScanner.MSBuild.exe begin /k:"Z-SmartStoreNet" /d:sonar.vb.file.suffixes=.no_vb6_files /d:sonar.cpp.file.suffixes=.no_cpp_files /d:sonar.xml.file.suffixes=.no_xml_files /d:sonar.javascript.file.suffixes=.no_js_files /d:sonar.typescript.file.suffixes=.no_ts_files /d:sonar.css.file.suffixes=.no_css_files /d:sonar.html.file.suffixes=.no_html_files /d:sonar.tsql.file.suffixes=.no_tsql_files /d:sonar.plsql.file.suffixes=.no_plsql_files /d:sonar.python.file.suffixes=.no_python_files /d:sonar.ruby.file.suffixes=.no_ruby_files /d:sonar.scm.disabled=true /d:sonar.branch.autoconfig.disabled=true /d:sonar.cpd.exclusions=**

  • MSBuild.exe /t:Rebuild /maxcpucount /v:m /nr:false /p:DeployExtension=false /warnaserror:AD0001 /clp:Summary .\src\SmartStoreNET.sln

  • SonarScanner.MSBuild.exe end

Expected behavior

Build successfully

Actual behavior

Build fails with error message

CSC : error AD0001: Analyzer 'SonarAnalyzer.Rules.CSharp.StringFormatValidator' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. [C:\Project\src\Plugins\SmartStore.PayPal\SmartStore.PayPal.csproj]

Providers\PayPalStandardProvider.cs(221,4): warning S2275: NRE Object reference not set to an instance of an object. [C:\Workspace\external-projects\SmartStoreNET\src\Plugins\SmartStore.PayPal\SmartStore.PayPal.csproj]
Providers\PayPalStandardProvider.cs(236,5): warning S2275: NRE Object reference not set to an instance of an object. [C:\Workspace\external-projects\SmartStoreNET\src\Plugins\SmartStore.PayPal\SmartStore.PayPal.csproj]

Related information

  • SonarC# Version 7.13

Additional info: after this gets fixed, we should add the SmartStoreNET project to the cirrus CI QA jobs

@andrei-epure-sonarsource andrei-epure-sonarsource added Type: Bug Exceptions and blocking issues during analysis. Area: C# C# rules related issues. Area: Rules labels Apr 18, 2019
@andrei-epure-sonarsource andrei-epure-sonarsource added this to the 7.14 milestone Apr 18, 2019
@andrei-epure-sonarsource andrei-epure-sonarsource changed the title NRE inside StringFormatValidator when analyzing SmartStore Fix NRE inside StringFormatValidator when analyzing SmartStore May 2, 2019
@andrei-epure-sonarsource andrei-epure-sonarsource changed the title Fix NRE inside StringFormatValidator when analyzing SmartStore Fix StringFormatValidator NRE due to array instantiation w/o initializer May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: Bug Exceptions and blocking issues during analysis.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants