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

Debugging session crash #4

Closed Eric898989 closed 5 years ago

Eric898989 commented 6 years ago

I have an issue debugging a mono app which uses MMALSHARP (Nuget package allowing to control the PICam of the rapsberry pi) [Program deployed on Raspian Stretch]

Here is the portion of the code triggering the crash of the mono debug session: try { MMALCamera MMALCam = MMALCamera.Instance; MMALCameraConfig.StillResolution = Resolution.As8MPixel; MMALCameraConfig.ExposureMode = MMAL_PARAM_EXPOSUREMODE_T.MMAL_PARAM_EXPOSUREMODE_FIXEDFPS; MMALCam.ConfigureCameraSettings(); } catch (Exception Ex) { Console.WriteLine(Ex.Message + " / " + Ex.InnerException.Message); }

Debugging session crash on "MMALCamera MMALCam = MMALCamera.Instance;" or "MMALCam.ConfigureCameraSettings();" without any error message...

No crash when code is run without debug.

Log VSMonoDebugger:

2018-09-25 22:25:04.4460|TRACE|VSMonoDebugger.Services.NLogService|Entering: SetRegistryRoot - XamarinEngine.cs(220) 2018-09-25 22:25:04.4460|TRACE|VSMonoDebugger.Services.NLogService|Entering: SetLocale - XamarinEngine.cs(214) 2018-09-25 22:25:04.4460|TRACE|VSMonoDebugger.Services.NLogService|Entering: LaunchSuspended - XamarinEngine.cs(112) 2018-09-25 22:25:04.4460|TRACE|VSMonoDebugger.Services.NLogService|Entering: SerializeDebuggerOptions - XamarinEngine.cs(34) 2018-09-25 22:25:04.8241|TRACE|VSMonoDebugger.Services.NLogService|Entering: ResumeProcess - XamarinEngine.cs(126) 2018-09-25 22:25:04.8241|TRACE|VSMonoDebugger.Services.NLogService|Entering: Attach - XamarinEngine.cs(154) 2018-09-25 22:25:05.0330|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:06.8571|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:06.8851|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:08.7997|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:08.8077|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:08.8077|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:08.8286|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:09.1554|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:09.4867|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:09.5067|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:09.5067|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:11.3346|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:11.8032|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:19.4849|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:23.0717|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:44.2403|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:46.7452|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:48.0341|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104) 2018-09-25 22:25:56.8620|TRACE|VSMonoDebugger.Services.NLogService|Entering: _session_TargetEvent - XamarinEngine.cs(104)

Do you have any way to increase the verbose level of the VSMonoDebugger in order to better understand where the problem is coming from?

GordianDotNet commented 6 years ago

I don't have a PICam. So I can't test it myself.

But you can activate mono trace output:

  1. Login via ssh

  2. Change to your deploy path

  3. Set Mono debug level: See logging-runtime-events for more information.

    export MONO_LOG_LEVEL=debug
    export MONO_LOG_MASK=all
  4. Start your program with debugger (replace MonoDebuggerTest.exe with your exe-Filename):

    mono --debugger-agent=address=0.0.0.0:11000,transport=dt_socket,server=y --debug=mdb-optimizations MonoDebuggerTest.exe
  5. Call the menu "Mono" / "Attach to mono debugger" from Visual Studio

  6. You get a very long trace output from mono

My guess is that the library runs unmanaged code with exceptions that can not be caught by the debugger. In my attempt without a PiCam, the library crashed with OutOfMemoryException.

GordianDotNet commented 5 years ago

I close this problem as no further feedback came after my reply.