Search Unity

Attach debugger to Android game on Mac

Discussion in 'Editor & General Support' started by yuch3n, Apr 18, 2019.

  1. yuch3n

    yuch3n

    Joined:
    Sep 26, 2018
    Posts:
    26
    In the past I've been able to run a game on device, set breakpoints in MonoDevelop, and have the device pause when it hits my breakpoint. The only thing is that this was back when I worked on a Windows machine.

    I'm now working on a Mac, and I can't seem to get the same thing to work anymore. I know that Visual Studio on Mac is essentially a skin of Mono, so, correct me if I'm wrong, I assume the Attach to Process option should work the same way. I do see my device in the list (see attached image). However, when I hit "Attach", it says "Debugger operation failed" and "Operation is not valid due to the current state of the object".

    I have Development Build, Autoconnect Profiler, and Script Debugging enabled in Build Settings. Am I missing something?

    Screen Shot 2019-04-18 at 2.40.08 PM.png
     
  2. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Hi @yuch3n, sorry for this issue. Could you please give us the VS 4 Mac version you are currently using ? It feels like something we already fixed.

    Regards
    Sebastien Lebreton [MSFT]
     
  3. yuch3n

    yuch3n

    Joined:
    Sep 26, 2018
    Posts:
    26
    Visual Studio for Mac Community Edition, Version 8.0.4 (build 0)
     
  4. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Ok thanks for confirming!

    Edit: tried on my mac, I do not repro with 8.0.4. I'm able to attach and debug a project.

    Could you repro and send us your logs (Help -> Open Log Directory) here:
    vstusp [at] microsoft [dot] com

    Regards
    Sebastien Lebreton [MSFT]
     
    Last edited: Apr 29, 2019
  5. yuch3n

    yuch3n

    Joined:
    Sep 26, 2018
    Posts:
    26
    I've sent the logs (a cut version with only the crash and some other things), but I'll post here just in case.


    Code (CSharp):
    1. ERROR [2019-04-29 16:49:09Z]: Error while drawing margin Mono.TextEditor.TextViewMargin
    2. System.ArgumentOutOfRangeException: should be <0 it was 4294967295
    3. Parameter name: textIndex
    4.   at Mono.TextEditor.TextViewMargin.TranslateToUTF8Index (System.String text, System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x000f7] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1542
    5.   at Mono.TextEditor.TextViewMargin+LayoutWrapper.TranslateToUTF8Index (System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x00000] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1671
    6.   at Mono.TextEditor.UnderlineTextSegmentMarker.InternalDraw (System.Int32 markerStart, System.Int32 markerEnd, Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Boolean selected, System.Int32 startOffset, System.Int32 endOffset, System.Double y, System.Double startXPos, System.Double endXPos) [0x00066] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:156
    7.   at Mono.TextEditor.UnderlineTextSegmentMarker.Draw (Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Int32 startOffset, System.Int32 endOffset) [0x00151] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:136
    8.   at Mono.TextEditor.TextViewMargin.DrawLinePart (Cairo.Context cr, Mono.TextEditor.DocumentLine line, System.Int32 lineNumber, System.Int32 logicalRulerColumn, System.Int32 offset, System.Int32 length, System.Double& position, System.Boolean& isSelectionDrawn, System.Double y, System.Double maxX, System.Double _lineHeight) [0x00c71] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:2195
    9.   at Mono.TextEditor.TextViewMargin.Draw (Cairo.Context cr, Cairo.Rectangle area, Mono.TextEditor.DocumentLine line, System.Int32 lineNr, System.Double x, System.Double y, System.Double _lineHeight) [0x00852] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:3286
    10.   at Mono.TextEditor.TextArea.RenderMargins (Cairo.Context cr, Cairo.Context textViewCr, Cairo.Rectangle cairoRectangle) [0x0017d] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs:2277
    11. ERROR [2019-04-29 16:49:09Z]: Error while drawing margin Mono.TextEditor.TextViewMargin
    12. System.ArgumentOutOfRangeException: should be <0 it was 4294967295
    13. Parameter name: textIndex
    14.   at Mono.TextEditor.TextViewMargin.TranslateToUTF8Index (System.String text, System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x000f7] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1542
    15.   at Mono.TextEditor.TextViewMargin+LayoutWrapper.TranslateToUTF8Index (System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x00000] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1671
    16.   at Mono.TextEditor.UnderlineTextSegmentMarker.InternalDraw (System.Int32 markerStart, System.Int32 markerEnd, Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Boolean selected, System.Int32 startOffset, System.Int32 endOffset, System.Double y, System.Double startXPos, System.Double endXPos) [0x00066] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:156
    17.   at Mono.TextEditor.UnderlineTextSegmentMarker.Draw (Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Int32 startOffset, System.Int32 endOffset) [0x00151] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:136
    18.   at Mono.TextEditor.TextViewMargin.DrawLinePart (Cairo.Context cr, Mono.TextEditor.DocumentLine line, System.Int32 lineNumber, System.Int32 logicalRulerColumn, System.Int32 offset, System.Int32 length, System.Double& position, System.Boolean& isSelectionDrawn, System.Double y, System.Double maxX, System.Double _lineHeight) [0x00c71] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:2195
    19.   at Mono.TextEditor.TextViewMargin.Draw (Cairo.Context cr, Cairo.Rectangle area, Mono.TextEditor.DocumentLine line, System.Int32 lineNr, System.Double x, System.Double y, System.Double _lineHeight) [0x00852] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:3286
    20.   at Mono.TextEditor.TextArea.RenderMargins (Cairo.Context cr, Cairo.Context textViewCr, Cairo.Rectangle cairoRectangle) [0x0017d] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs:2277
    21. ERROR [2019-04-29 16:49:09Z]: Error while drawing margin Mono.TextEditor.TextViewMargin
    22. System.ArgumentOutOfRangeException: should be <0 it was 4294967295
    23. Parameter name: textIndex
    24.   at Mono.TextEditor.TextViewMargin.TranslateToUTF8Index (System.String text, System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x000f7] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1542
    25.   at Mono.TextEditor.TextViewMargin+LayoutWrapper.TranslateToUTF8Index (System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x00000] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1671
    26.   at Mono.TextEditor.UnderlineTextSegmentMarker.InternalDraw (System.Int32 markerStart, System.Int32 markerEnd, Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Boolean selected, System.Int32 startOffset, System.Int32 endOffset, System.Double y, System.Double startXPos, System.Double endXPos) [0x00066] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:156
    27.   at Mono.TextEditor.UnderlineTextSegmentMarker.Draw (Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Int32 startOffset, System.Int32 endOffset) [0x00151] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:136
    28.   at Mono.TextEditor.TextViewMargin.DrawLinePart (Cairo.Context cr, Mono.TextEditor.DocumentLine line, System.Int32 lineNumber, System.Int32 logicalRulerColumn, System.Int32 offset, System.Int32 length, System.Double& position, System.Boolean& isSelectionDrawn, System.Double y, System.Double maxX, System.Double _lineHeight) [0x00c71] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:2195
    29.   at Mono.TextEditor.TextViewMargin.Draw (Cairo.Context cr, Cairo.Rectangle area, Mono.TextEditor.DocumentLine line, System.Int32 lineNr, System.Double x, System.Double y, System.Double _lineHeight) [0x00852] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:3286
    30.   at Mono.TextEditor.TextArea.RenderMargins (Cairo.Context cr, Cairo.Context textViewCr, Cairo.Rectangle cairoRectangle) [0x0017d] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs:2277
    31. ERROR [2019-04-29 16:49:09Z]: Error while drawing margin Mono.TextEditor.TextViewMargin
    32. System.ArgumentOutOfRangeException: should be <0 it was 4294967295
    33. Parameter name: textIndex
    34.   at Mono.TextEditor.TextViewMargin.TranslateToUTF8Index (System.String text, System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x000f7] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1542
    35.   at Mono.TextEditor.TextViewMargin+LayoutWrapper.TranslateToUTF8Index (System.UInt32 textIndex, System.UInt32& curIndex, System.UInt32& byteIndex) [0x00000] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:1671
    36.   at Mono.TextEditor.UnderlineTextSegmentMarker.InternalDraw (System.Int32 markerStart, System.Int32 markerEnd, Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Boolean selected, System.Int32 startOffset, System.Int32 endOffset, System.Double y, System.Double startXPos, System.Double endXPos) [0x00066] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:156
    37.   at Mono.TextEditor.UnderlineTextSegmentMarker.Draw (Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, Mono.TextEditor.LineMetrics metrics, System.Int32 startOffset, System.Int32 endOffset) [0x00151] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs:136
    38.   at Mono.TextEditor.TextViewMargin.DrawLinePart (Cairo.Context cr, Mono.TextEditor.DocumentLine line, System.Int32 lineNumber, System.Int32 logicalRulerColumn, System.Int32 offset, System.Int32 length, System.Double& position, System.Boolean& isSelectionDrawn, System.Double y, System.Double maxX, System.Double _lineHeight) [0x00c71] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:2195
    39.   at Mono.TextEditor.TextViewMargin.Draw (Cairo.Context cr, Cairo.Rectangle area, Mono.TextEditor.DocumentLine line, System.Int32 lineNr, System.Double x, System.Double y, System.Double _lineHeight) [0x00852] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs:3286
    40.   at Mono.TextEditor.TextArea.RenderMargins (Cairo.Context cr, Cairo.Context textViewCr, Cairo.Rectangle cairoRectangle) [0x0017d] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs:2277
    41. ERROR [2019-04-29 16:56:06Z]: Debugger operation failed
    42. System.InvalidOperationException: Operation is not valid due to the current state of the object.
    43.   at MonoDevelop.Debugger.AD7.AD7DebuggerSession.OnRun (Mono.Debugging.Client.DebuggerStartInfo startInfo) [0x0007a] in <e7c9850b3ffd438fa8c95be179b3eb7f>:0
    44.   at MonoDevelop.Unity.Debugger.UnityDebuggerSession.OnAttachToProcess (Mono.Debugging.Client.ProcessInfo processInfo) [0x0001c] in <0715ef0733ab43bd82e717a1c5777839>:0
    45.   at Mono.Debugging.Client.DebuggerSession+<>c__DisplayClass94_0.<AttachToProcess>b__0 () [0x00000] in /Users/vsts/agent/2.149.2/work/1/s/monodevelop/main/external/debugger-libs/Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs:377
    46.  
     
  6. IMD

    IMD

    Joined:
    Mar 21, 2013
    Posts:
    14
    Hi @yuch3n , @sailro , I'm just wondering if you made any progress here? I'm also getting the same issue and feel like how the cat looks in yuch3n's profile at the moment..
     
  7. yuch3n

    yuch3n

    Joined:
    Sep 26, 2018
    Posts:
    26
    @IMD Hahaha I love this cat meme

    But yes, when I emailed VS Tools they told me to use this workaround:
    "In Tools for Unity -> Debugging, change the debugger engine from VSTU to Mono. Let us know if that works around the issue."
    upload_2019-9-19_15-5-22.png


    It worked for me. I haven't heard back from them about whether the issue was solved yet though.
     
  8. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Hello,

    Yes, we solved the issue for VS4Mac 8.2.x series. So you should re-use the VSTU debugger that is tailored for Unity.
    Are you still hitting the issue with an updated VS4Mac or are you using an old version ?

    Regards
    Sebastien Lebreton [MSFT]
     
  9. vishal

    vishal

    Joined:
    Aug 8, 2012
    Posts:
    14
    This issue still persist even I am using latest version of VS.
    VS version: 8.3.10 (Mac Community edition)