Can't debug native test with custom board in same project


When I try to debug my native test, I get this error:

Error: Traceback (most recent call last):
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/", line 71, in invoke
    return super().invoke(ctx)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/debug/", line 84, in cli
    return _debug_in_project_dir(
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/debug/", line 119, in _debug_in_project_dir
    debug_config =
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/debug/config/", line 37, in new
AttributeError: 'dict' object has no attribute 'get_debug_tool_name'

I narrowed it down to the fact that in the same project, I have a custom board for one of my env and I have native test as another env. Like this:

platform = ststm32
board = myCustomBoard
framework = stm32cube
; ...

platform = native
debug_test = test_communication
; ...

I have a json file in the ${project_dir}/boards/myCustomBoard.json

I tried to patch around the platformio code, but I’m not sure what to do to be able to debug the native_test env and the myCustomBoard env.

Thank you