Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on Linux #6

Closed
zapoutix opened this issue Jan 30, 2016 · 14 comments
Closed

Not working on Linux #6

zapoutix opened this issue Jan 30, 2016 · 14 comments

Comments

@zapoutix
Copy link

Hello i am trying this extension on Linux,
and in VS code i have the following error :

UnityDebug: Attached to Unity process 'Unity Editor (Unity)' (14215)
UnityDebug: Disconnected

The disconnected message arrive 5 second after the first one.

in the UnityDebug-log.txt, i have the following exception;

00:47:51.920004: Log

00:47:51.925793: UnityDebug
00:47:55.454226: iOS USB Error: System.TypeInitializationException: The type initializer for 'MonoDevelop.Debugger.Soft.Unity.Usbmuxd' threw an exception. ---> System.NotSupportedException: Platform not supported
at MonoDevelop.Debugger.Soft.Unity.Usbmuxd..cctor () <0x41c75880 + 0x000a3> in :0
--- End of inner exception stack trace ---
at MonoDevelop.Debugger.Soft.Unity.iOSDevices.get_Initialized () <0x41c75800 + 0x0000f> in :0
at MonoDevelop.Debugger.Soft.Unity.iOSDevices.GetUSBDevices (MonoDevelop.Debugger.Soft.Unity.ConnectorRegistry connectors, System.Collections.Generic.List`1 processes) <0x41c75510 + 0x00037> in :0
at MonoDevelop.Debugger.Soft.Unity.UnityProcessDiscovery.GetUnityiOSUsbProcesses () <0x41c753c0 + 0x00093> in :0
00:47:55.454396: Found Unity process: Unity Editor (Unity) (14215)
00:47:55.460939: UnityDebug: Attached to Unity process 'Unity Editor (Unity)' (14215)

00:47:59.967504: UnityDebug: Disconnected

I am on Linux Mint 17.3
mono version :
Mono JIT compiler version 4.2.2 (Stable 4.2.2.30/996df3c Fri Jan 22 00:02:19 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen

VS Code version:
Version 0.10.6
Commit a80232bbcfe8a5cdad1ebc98638673d9dcb02458
Date 2015-12-19T11:26:42.359Z
Shell 0.34.5
Renderer 45.0.2454.85
Node 4.1.1

Unity 3d version:
Version 5.3.1f1 (c128b18ee020) Personal
Wed, 06 Jan 2016 19:04:47 GMT
Branch: 5.3/linux/editor

If you need more information don't hesitate.

Regards,
Mathieu

@lukaszunity
Copy link
Contributor

Do you have Editor Attaching enabled in Preferences / External Tools? Looks like the debugger finds Unity and then attached for like 4 seconds and then detaches. Could look like Editor Attaching is disabled.

@zapoutix
Copy link
Author

zapoutix commented Feb 4, 2016

Well, i remove Unity and reinstall it and it worked.
but after reboot debugger did same as before.
The issue is probably due to the beta stage of unity3d on linux.

Editor Attaching is enabled.

@lukaszunity
Copy link
Contributor

I see do. Do you have the same issue with MonoDevelop on Linux?

I would report this issue on the Unity Linux forum: http://forum.unity3d.com/forums/linux-editor-support-feedback-experimental.93/

Closing this issue until it has been figured whether this is an issue with the Linux editor.

@ru-ace
Copy link

ru-ace commented Mar 24, 2016

Hi! I found solution.
At first - this is not this extension issue, this is dotBunny VSCode plugin issue.
At current version it buggy when setting AllowAttachedDebuggingOfEditor to true
I think this is because Unity want restart after change this settings, but don't dig deeper.

So easy solution is to open VSCode/Plugins/Editor/VSCode.cs find all EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor" and comment it.
After that restart unity and enable Preferences / External Tools / Editor Attaching manually

After that Debug will work perfect.

ps: sorry for my english

@lukaszunity
Copy link
Contributor

@reapazor: See above.

@reapazor
Copy link

It is interesting that it is linux only ....

My first instinct due to the limited exposure of this problem is to wonder about the whole requirement to restart. Is that no longer there on Linux? We used to get a warning message about changing those settings and requiring restart. Of course it's on a different section of the preferences when the plugin changes it.

Maybe I should force restart the editor? Or present my own warning ...

However, @ru-ace is indicating that restarting didn't resolve that ...

I'm still not exactly sure what is causing this :( from an attachment point i'm just changing the preference flag ...

@lukaszunity ideas?

@lukaszunity
Copy link
Contributor

@reapazor Personally I would just not support chaning the preference and let the users control whether Editor Attaching should be enabled or not through the Preferences.

I think we at Unity should revisit whether disabling editor attaching even makes sense.

@reapazor
Copy link

That creates the support nightmare of "why isnt it working" for some users.
I have noticed other quirks with the preference window before, this may be another one to work around.

@lukaszunity
Copy link
Contributor

I could see if I could add an error message to the debugger extension when attaching to editor fails, sometime in the lines of "Unable to attach to Unity Editor. Is Editor Attaching in Preferences enabled?"

@reapazor
Copy link

That could work wonderfully :)

It just seems odd that this is an edge case happening on Linux only, feels like something deeper.

@ru-ace
Copy link

ru-ace commented Mar 30, 2016

@reapazor I don't know how it should work at other operation system.
I debug VSCode plugin on linux with this extension and found some stranges:

  1. I thought that global problem in option VSCode_RevertScriptEditorOnExit.
    On exit AllowAttachedDebuggingOfEditor was set to false, and when Unity start next time it started with disabled option "Editor Attaching", but VSCode plugin set it to true - this is not enable "Editor Attaching" in this session(until you restart Unity) and we come to loop: users see that "Editor Attaching" is enable, but in real it disable.
  2. When i start play scene, if VSCode_RevertScriptEditorOnExit = true, in System_AppDomain_CurrentDomain_DomainUnload called UpdateUnityPreferences(false), that set AllowAttachedDebuggingOfEditor to false.
    After that always called UpdateUnityPreferences(true).
  3. And finally something real strange:
    in UpdateUnityPreferences(true) EditorPrefs.GetBool("AllowAttachedDebuggingOfEditor", false) return true, so VSCode_PreviousAttach must be undefined (in my case all EditorPrefs.SetBool("VSCode_PreviousAttach") was commented, but in UpdateUnityPreferences(false) EditorPrefs.GetBool("VSCode_PreviousAttach", true) return false!!!, and called EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", false);

I think it good idea to enable "Editor Attaching" only in case when it need for plugin and disabled(in this case show warning that user must restart Unity), but in other cases don't touch this setting.

@reapazor
Copy link

reapazor commented Apr 3, 2016

Just to bring this discussion full circle (useful for lukaz)

The problem was that the plugin has a feature which disables its changes on exit. I use this on a daily basis as #code cannot handle the size of some of my projects, so i have to revert to Xamarin.

However what it does internally was revert the "Editor Attaching" part of Unity. This is where things breakdown as Unity needs a restart when its state changes, thusly the plugin changes it without forcing a restart.

I've altered the repository version to simply always have it on, turn it on, and never turn it off. I can't see of a reason why it would never need to be off really.

Lukaz - Is there something I can call if i were to be switching it that would reload what ever is necessary? or is this approach probably the safest for now.

@lukaszunity
Copy link
Contributor

Due to the way Mono is initialized and used in Unity, the debugger must be initialized as part of the initial startup in Unity. A restart is therefore required when changing editor attaching.

@BrandenIngram
Copy link

Hi I was having a similar issue of the debugger detaching after 5seconds on Ubuntu 18.04, I was able to solve the issue with installing mono - with these instructions https://www.mono-project.com/download/stable/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants