Pio check cppccheck addon error

I am trying to use the cppcheck misra addon. If I run

pio check -v --flags "cppcheck: --addon=misra.json"

I get this python error

Bailing out from checking F:\arduino\platformio mkrzero test\src\main.cpp since there was an internal error: Failed to execute 'c:\users\ian66\.platformio\penv\scripts\python.exe C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py --cli --rule-texts=misra-rules.txt "F:\arduino\platformio mkrzero test\src\main.cpp.dump"'. Traceback (most recent call last):

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py", line 3620, in <module>

main()

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py", line 3564, in main

checker.parseDump(item)

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py", line 3369, in parseDump

for cfgNumber, cfg in enumerate(data.iterconfigurations()):

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 927, in iterconfigurations

cfg.setIdMap(cfg_arguments)

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 740, in setIdMap

self.set_id_map(functions_arguments)

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 727, in set_id_map

scope.setId(IdMap)

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 396, in setId

self.varlist.append(IdMap[v])

KeyError: '000001B540564840'

Please post this issue, along with the project files that it can be reproduced with, at Issues · platformio/platformio-core · GitHub.

2

For me, the problem was resolved after I edited the projects and checked “Enable Code Analysis on Build”. I was then able to uncheck this option, but it leaves

<RunCodeAnalysis>false</RunCodeAnalysis>

in the vcxproj file, which seems to resolve the problem.