Caphyon / clang-power-tools

Bringing clang-tidy magic to Visual Studio C++ developers.
http://www.clangpowertools.com
Apache License 2.0
472 stars 57 forks source link

CPT is causing VS2022 to crash #1291

Closed netx123 closed 1 year ago

netx123 commented 1 year ago

Using latest CPT v2023.5 and VS2022 (17.6.1)

On a basic project, selecting the 'Tidy' option causes Visual Studio to crash, with the following information appearing in the event logs:

Fault bucket 1442362185884006642, type 5 Event Name: CLR20r3 Response: Not available Cab Id: 0

Problem signature: P1: devenv.exe P2: 17.6.33717.318 P3: 6465629a P4: ClangPowerToolsLib17 P5: 1.0.0.0 P6: b2d9c861 P7: 921 P8: 83 P9: PSZQOADHX1U5ZAHBHOHGHLDGIY4QIXHX P10:

and:

Description: A .NET application failed. Application: ServiceHub.Host.dotnet.x64.exe Path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.Dotnet.x64\ServiceHub.Host.dotnet.x64.exe Message: Failed to read environment variable [DOTNET_STARTUP_HOOKS], HRESULT: 0x800700CB

mariru27 commented 1 year ago

Hi @netx123,

Can you try to test Clang Power Tools v2023.4.0 and Clang Power Tools v2023.3 and let me know if you have the same issue?

Kind regards, Marina

netx123 commented 1 year ago

Hi @mariru27 ,

I've tested both v2023.4 and v2023.3 and they also exhibit the crash.

mariru27 commented 1 year ago

Sorry @netx123, I made a mistake, please try to test Clang Power Tools v2023.2.0

netx123 commented 1 year ago

I've tested with v2023.2.0 , this is also crashing

mariru27 commented 1 year ago

Hi @netx123,

Thank you for bringing this issue to our attention and for your quick responses. After multiple attempts on my end, I am unable to replicate the issue. Could you please try formatting and compiling the code to see if the problem still persists?

Best regards, Marina

netx123 commented 1 year ago

Hi @mariru27 , I've also tried using Compile and Format and these also result in the same crash.

From the testing I've discovered that even an empty c++ project with just the most minimal main() will cause the crash.

Interestingly, the crash will only happen if performing a Compile, Format or Tidy immediately after opening the project.

If I make even a single change to a .cpp file (and then save the changes) in the project, then perform the Tidy, it does not crash.

I could be wrong but it looks like CPT is not triggering a save of files before performing the checks, could this be something to do with the crash?

mariru27 commented 1 year ago

I think this crash may be because of last Visual Studio update (17.6.1), they made some performance enhancements on solution opening that can trigger this bug

I still cannot reproduce this problem Did you check on another version of Visual Studio (2019 for example)?

netx123 commented 1 year ago

Yes it works fine on VS2019

mariru27 commented 1 year ago

Hi @netx123,

Did you try update Visual Studio 2022 to v17.6.2? It may fix your bug

Kind regards, Marina

netx123 commented 1 year ago

Hi @mariru27 , Unfortunately the issue still persists with v17.6.2

netx123 commented 1 year ago

I've noticed that newly created solutions don't crash with CPT, so I went back and deleted all the build folders as well as the .vs folder of the solutions that were crashing, and that seems to have resolved the issue.

mariru27 commented 1 year ago

I will close this issue as it has been solved