GordianDotNet / VSMonoDebugger

Enables Visual Studio 2017 to deploy and debug a mono application on remote linux machines via SSH.
MIT License
49 stars 25 forks source link

Debug fails with EXCEPTION: System.MissingMethodException: Method not found: 'System.String Mono.Debugger.Soft.ModuleMirror.get_SourceLink()'. #15

Closed mahoekst closed 4 years ago

mahoekst commented 4 years ago

Trying to debug on my RPI Zero. I get this message: Latest version of mono installed. Mono JIT compiler version 5.18.0.240 (Debian 5.18.0.240+dfsg-3 Sat Apr 20 05:16:08 UTC 2019) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: SIGSEGV: normal Notifications: epoll Architecture: armel,vfp+hard Disabled: none Misc: softdebug Interpreter: yes LLVM: supported, not enabled. Suspend: preemptive GC: sgen (concurrent by default)

This is the error message dialog in Visual Studio 2019 Preview Version 16.5.0 Preview 1.0)


Microsoft Visual Studio

EXCEPTION: System.MissingMethodException: Method not found: 'System.String Mono.Debugger.Soft.ModuleMirror.get_SourceLink()'.

at Mono.Debugging.Soft.SoftDebuggerSession.GetSourceLinkMaps(MethodMirror method)

at Mono.Debugging.Soft.SoftDebuggerSession.GetSourceLink(MethodMirror method, String originalFileName) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerSession.cs:line 817

at Mono.Debugging.Soft.SoftEvaluationContext..ctor(SoftDebuggerSession session, StackFrame frame, EvaluationOptions options) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftEvaluationContext.cs:line 46

at Mono.Debugging.Soft.SoftDebuggerBacktrace.GetEvaluationContext(Int32 frameIndex, EvaluationOptions options) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerBacktrace.cs:line 222

at Mono.Debugging.Soft.SoftDebuggerBacktrace.CreateStackFrame(StackFrame frame, Int32 frameIndex) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerBacktrace.cs:line 175

at Mono.Debugging.Soft.SoftDebuggerBacktrace.GetStackFrames(Int32 firstIndex, Int32 lastIndex) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerBacktrace.cs:line 85

at Mono.Debugging.Client.Backtrace.GetFrame(Int32 index, Int32 fetchMultipleCount) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging\Mono.Debugging.Client\Backtrace.cs:line 57

at Mono.Debugging.Client.Backtrace..ctor(IBacktrace serverBacktrace) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging\Mono.Debugging.Client\Backtrace.cs:line 26

at Mono.Debugging.Soft.SoftDebuggerSession.GetThreadBacktrace(ThreadMirror thread) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerSession.cs:line 852

at Mono.Debugging.Soft.SoftDebuggerSession.HandleBreakEventSet(Event[] es, Boolean dequeuing) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerSession.cs:line 1995

at Mono.Debugging.Soft.SoftDebuggerSession.HandleEventSet(EventSet es) in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerSession.cs:line 1739

at Mono.Debugging.Soft.SoftDebuggerSession.EventHandler() in E:\A_work\3718\s\external\debugger-libs\Mono.Debugging.Soft\SoftDebuggerSession.cs:line 1639

OK

GordianDotNet commented 4 years ago

I tested it with

Microsoft Visual Studio Community 2019 Version 16.4.2

Mono JIT compiler version 5.18.1.0 (tarball Fri Mar 15 21:15:07 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          yes(600)
        Suspend:       preemptive
        GC:            sgen (concurrent by default)

on

Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l

You should test it with the latest none preview version of Visual Studio. If you have a simple test project. I could test it on my raspberry pi.

jasonswearingen commented 4 years ago

I just hit this same issue, trying to attach a debugger to a Godot Mono (game engine) project I'm prototyping.

I can attach the debugger with this extension, but when I try to set a breakpoint the same-ish error popup shows.

sorry I am not "into" the mono ecosystem and just barely know how to run an app (godot) that embeds mono, and attach a debugger to it.

FYI, using VS2019 and it's mono extension works. I can debug properly.

I know it's probably too impractical for you to test out my particular error because of the convoluted steps you'd have to take to repro it, but just in case you want to......

GordianDotNet commented 4 years ago

@jasonswearingen The day before yesterday I had no luck. Visual Studio stopped, but no source code was displayed. However, I could not find any hint of the exception "System.MissingMethodException". Today it worked with the setting in step 5.

My steps:

  1. start Godot_v3.2-beta6_mono_win64\Godot_v3.2-beta6_mono_win64.exe

  2. import godot-csharp-tech\demo-projects\ball-run\project.godot

  3. open godot-csharp-tech\demo-projects\ball-run\CSharp Tools Demo - Ball Run.sln

  4. set "CSharp Tools Demo - Ball Run" as StartProject

  5. IMPORTANT: Use the same configuration as in godot "Tools" (the source code path have to match) After that the output path is godot-csharp-tech\demo-projects\ball-run\mono\temp\bin\Tools for Visual Studio AND godot!

  6. [godot] Run with "wait for debugger"

  7. [VS] Attach to mono debugger (127.0.0.1)

  8. Break points and debugging works for me as expected

I have used VSMonoDebugger 1.0.5 Settings: Debug/Deploy on local Windows: YES Local Deploy Path: EMPTY Mono Debug Port: 23685

But I wonder why in this case no mdb files are necessary!

jasonswearingen commented 4 years ago

@GordianDotNet I tried your workflow, but I am still getting the same error.

can you please clarify step 5? I think I am not performing the step properly. Here is what I did:

  1. changed the Csharp Tools Demo" projects default and active configuration to "Tools"
    • this set the output path to .mono\temp\bin\Tools\, note the "." in front of mono, you didn't mention that in your output path, but I assume that was a typo?
    • when I set the Tools config output path to mono\temp\bin\Tools\ (without the ".") godot.exe can not find the built dll.
  2. I opened the VSMonoDebugger Extension's settings and set it as you suggested
    • i also tried setting the local deploy path explicitly, but that didn't help
GordianDotNet commented 4 years ago

@mahoekst and @jasonswearingen Can you look into Visual Studio 2019/Help/"About Microsoft Visual Studio" and use the Copy Info to paste your installed Extensions.

I added a old version of the Mono Debugger (see Mono.Debugging.VisualStudio.4.9.10-pre). It looks like VSMonoDebugger uses the newer dll versions from Visual Studio. Because the Mono.Debugging.Soft 4.9.10 doesn't have pdb files with source file informations. See mono-debugging-for-visual-studio-doesnt-become-ena

Have you installed something from Xamarin (Xamarin Tools, ...)?

jasonswearingen commented 4 years ago

yes, i have xamarin installed but don't use it. i'll delete that stuff and try again.

in the meantime, here is my current info: ``` Microsoft Visual Studio Community 2019 Version 16.4.3 VisualStudio.16.Release/16.4.3+29709.97 Microsoft .NET Framework Version 4.8.03752 Installed Version: Community Visual C++ 2019 00435-60000-00000-AA502 Microsoft Visual C++ 2019 ASP.NET and Web Tools 2019 16.4.457.38025 ASP.NET and Web Tools 2019 Azure App Service Tools v3.0.0 16.4.457.38025 Azure App Service Tools v3.0.0 C# Tools 3.4.1-beta4-19610-02+c4e5d138903b899477649a17f197abd2bcb22f9e C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package Mono Debugging for Visual Studio 16.5.24 (1fafd7e) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 5.4.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info Test Adapter for Boost.Test 1.0 Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory. Test Adapter for Google Test 1.0 Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory. Visual Basic Tools 3.4.1-beta4-19610-02+c4e5d138903b899477649a17f197abd2bcb22f9e Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 10.4 for F# 4.6 16.4.0-beta.19556.5+e7597deb7042710a7142bdccabd6f92b0840d354 Microsoft Visual F# Tools 10.4 for F# 4.6 Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio Visual Studio Tools for CMake 1.0 Visual Studio Tools for CMake Visual Studio Tools for CMake 1.0 Visual Studio Tools for CMake VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Foo 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio VSMonoDebuggerPackage Extension 1.0 VSMonoDebuggerPackage Visual Studio Extension Detailed Info Xamarin 16.4.000.308 (d16-4@4755fb3) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 16.4.0.475 (remotes/origin/d16-4@ac250f5aa) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 16.4.25 (579ee62) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 10.1.3.7 (d16-4/d66aed0) Xamarin.Android Reference Assemblies and MSBuild support. Mono: fd9f379 Java.Interop: xamarin/java.interop/d16-4@c4e569f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.28.0@46204c4 Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b Xamarin.iOS and Xamarin.Mac SDK 13.10.0.17 (5f802ef) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```
jasonswearingen commented 4 years ago

I uninstalled Xamarin, and now it's working! man, that was frustrating. I just happened to have it installed because I figured it wouldn't hurt, when trying to get debugging working. wow.

jasonswearingen commented 4 years ago

@GordianDotNet thank you for the help. I did a pull request on the Godot docs explaining how to use your debugger successfully.

Thanks again.