question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[VS Code] ReadMemory request causes cast exception on macOS

See original GitHub issue

I’m issuing a ReadMemory request from a VSCode extension using:

const readMemoryResp = await vscode.debug.activeDebugSession.customRequest('readMemory', { memoryReference: memoryReference, count: count, offset: offset });

It works absolutely fine on Windows. However on macOS (Catalina 10.15.7) the following exception occurs:

“Specified cast is not valid.”

I have traced it to the following line of code:

int hr = ((IDebugMemoryBytesDAP)m_engine).CreateMemoryContext(address, out memoryContext);

in AD7DebugSession.cs in the function GetMemoryContext().

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
WardenGnawcommented, Nov 20, 2020

Yep. This most likely is a bug with mono and how it handles embedded interfaces.

We have not had the chance to test readMemory requests on macOS/Linux.

https://github.com/microsoft/MIEngine/pull/1082 should fix the cast exception, but the cast may still fail in mono. https://github.com/microsoft/MIEngine/pull/1075 is part of the progress to move to .NET Core. It is moving to an SDK styled csproj which should make it easier to convert it from .NET Framework v4.6.2 to .NET Core 5.

1reaction
gareth-davies-imgcommented, Nov 20, 2020

@WardenGnaw Many thanks for looking at this issue.

We are using VSCode 1.51.1 and cpptools 1.1.2 out the box, so are using the standard cppdbg.ad7Engine.json.

And I can confirm that the same cast exception happens on Linux.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Terminal launch failures
The troubleshooting steps, such as checking your settings and enabling logging, apply to all platforms that support VS Code; macOS, Linux, and Windows....
Read more >
Running Visual Studio Code on macOS
Launching from the command line · Launch VS Code. · Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell...
Read more >
JavaScript API | Frida • A world-class dynamic instrumentation ...
Observe and reprogram running programs on Windows, macOS, GNU/Linux, iOS, watchOS, tvOS, Android, FreeBSD, and QNX.
Read more >
Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
VSCode hot reload for Flutter does not work
I'm on a Macbook Pro 2015 running macOS Mojave Version 10.14.2 if that helps. There isn't really any code to show, it's not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found