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

Hello,

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/__main__.py", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/cli.py", line 71, in invoke
    return super().invoke(ctx)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/debug/cli.py", line 84, in cli
    return _debug_in_project_dir(
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/debug/cli.py", line 119, in _debug_in_project_dir
    debug_config = DebugConfigFactory.new(
  File "/home/marc/.platformio/penv/lib/python3.10/site-packages/platformio/debug/config/factory.py", line 37, in new
    board_config.get_debug_tool_name(
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:

[env:myCustomBoard]
platform = ststm32
board = myCustomBoard
framework = stm32cube
; ...

[env:native_test]
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