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

CFamily: exception gathering configuration in VS2019 #1339

Closed
duncanp-sonar opened this issue Apr 20, 2020 · 2 comments
Closed

CFamily: exception gathering configuration in VS2019 #1339

duncanp-sonar opened this issue Apr 20, 2020 · 2 comments
Assignees
Projects
Milestone

Comments

@duncanp-sonar
Copy link
Contributor

duncanp-sonar commented Apr 20, 2020

Description

SLVS v2019 throws an exception gathering compiler configuration.

This might/might not be related to the fact that the project was a VS2017 that was opened in VS2019 (see repro steps below). Either way, SLVS shouldn't throw an exception.

Repro steps

Please provide the steps required to reproduce the problem

  1. Clone https://github.com/microsoft/DirectX-Graphics-Samples.git
  2. In VS2019, open DirectX-Graphics-Samples\Samples\Desktop\D3D12HeterogeneousMultiadapter\src\D3D12HeterogeneousMultiadapter.vcxproj

You should be prompted to upgrade the project. Click Cancel

  1. Open D3D12HeterogeneousMultiadapter.cpp

Expected behavior

The file is analyzed and issues reported.

Actual behavior

No issues. Exception logged in output window:

Unable to collect C/C++ configuration for D:\repos\other\ms\DirectX-Graphics-Samples\Samples\Desktop\D3D12HeterogeneousMultiadapter\src\D3D12HeterogeneousMultiadapter.cpp: System.ArgumentNullException: Value cannot be null.
Parameter name: rule
   at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.Rules.ConfigurationCustomBuildTool..ctor(IRule rule, ConfiguredProject configuredProject)
   at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCCustomBuildToolShim..ctor(String contextName, IRule rule, VCConfigurationShim configScope, VCFileShim fileContext)
   at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCFileConfigurationShim.<<get_Tool>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.ApartmentMarshaler.<>c__DisplayClass9_0`1.<<Invoke>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod, JoinableTaskCreationOptions creationOptions)
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod)
   at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.ApartmentMarshaler.Invoke[TResult](Func`1 method)
   at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCFileConfigurationShim.get_Tool()
   at CallSite.Target(Closure , CallSite , Object )
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.TryGet(ProjectItem projectItem, String absoluteFilePath)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.TryGetConfig(ILogger logger, ProjectItem projectItem, String absoluteFilePath)

Known workarounds

  • Analyse in VS2017, or
  • click "ok" when asked to upgrade.

Related information

  • SonarLint for VS Version: v4.20+
@duncanp-sonar duncanp-sonar added this to the CFamily streaming milestone Jun 11, 2020
@duncanp-sonar duncanp-sonar added this to To do in CFamily streaming via automation Jun 11, 2020
@rita-gorokhod rita-gorokhod moved this from To do to In progress in CFamily streaming Jul 2, 2020
@rita-gorokhod rita-gorokhod moved this from In progress to To do in CFamily streaming Jul 3, 2020
@duncanp-sonar
Copy link
Contributor Author

This seems to be related to the PlatformToolset value in the vcxproj file. Without upgrading, the value is v141 (in two places in the file) -> cannot analyse files in the project. Also, the project property window doesn't look right:

image

Changing the PlatformToolset to v142 fixes the issue. The files can be analysed and the project property window looks as normal:

image

So this might be a more general problem to do with platform toolsets not being available.

@duncanp-sonar duncanp-sonar removed this from the CFamily streaming milestone Jul 3, 2020
@duncanp-sonar duncanp-sonar removed this from To do in CFamily streaming Jul 3, 2020
@rita-gorokhod rita-gorokhod added this to the Hardening milestone Jul 21, 2020
@rita-gorokhod rita-gorokhod added this to To do in Hardening via automation Jul 21, 2020
@rita-gorokhod rita-gorokhod moved this from To do to In progress in Hardening Jul 30, 2020
@rita-gorokhod rita-gorokhod self-assigned this Jul 30, 2020
@rita-gorokhod
Copy link
Contributor

Closing as Won't Fix. This seems to be a general problem with project upgrade, as the Property Pages do not load properly in VS itself. The workaround is to click 'ok' when prompted to upgrade (and can select 'No upgrade' as an option).

Hardening automation moved this from In progress to Done Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Hardening
  
Done
Development

No branches or pull requests

2 participants