Closed vexir closed 9 years ago
This looks like something todo with VSCode installation more so then a plugin, and having looked at your attempts at UniVSCode as well I suspect there might be other issues at play.
Can't find custom attr constructor image: /Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/approot/packages/Microsoft.AspNet.Cryptography.Internal/1.0.0-beta4/lib/dnx451/Microsoft.AspNet.Cryptography.Internal.dll mtoken: 0x0a000004 Assertion at class.c:5695, condition `!mono_loader_get_last_error ()' not met
Seems to be the core of the issue, and unrelated to the plugin.
A VSCode rep I'm talking to suggested it might be an out of date version of Mono, but I just updated to the latest and it doesn't seem to help.
Any idea what might be the problem with my VSCode install?
I just looked at my VSCode install ...
The error message ...
Can't find custom attr constructor image: /Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/approot/packages/Microsoft.AspNet.Cryptography.Internal/1.0.0-beta4/lib/dnx451/Microsoft.AspNet.Cryptography.Internal.dll mtoken: 0x0a000004
Mentions a path /Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/approot/packages/...
My install doesnt have that, I suspect yours is similar ...
/Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/packages/...
Would be the valid pathing (that nasty "approot" is killing you) to what its looking for, so I suspect something is fubar in a config somewhere?
Doesn't look like it. I was able to cd all the way down into where that Microsoft.AspNet.Cryptography.Internal.dll file is and it exists. Something it's doing perhaps is causing the error? I'm not sure how to debug any further...
A quick googling gives me some ideas ...
Kind of suggests that the compiler you've got installed may be older then the latest, which would back what the Visual Studio Code rep was saying.
Did you install mono from source at any point in the past?
It's entirely possible, though I don't really remember it. I did do a
brew reinstall mono
which I'd imagine would have fixed it - my mono version now reads 4.2
Perhaps does Unity use a version of Mono that's installed somewhere else that isn't being updated by my terminal command?
Unity itself has its own mono runtime, but we're not using that for any of this (nor is VS Code).
What I would personally do in this situation is uninstall from homebrew mono (hoping that it cleanly does it) and then download either mono directly from the source:
http://www.mono-project.com/download/
Or you can also grab Xamarin Studio, and have it install Mono for you (its made by the makers of Mono):
Hey! That did the trick. I guess home-brew was installing some crazy version of mono.
I'm getting code completion and go to declaration and all that fun stuff now.
Debugging doesn't seem to work however. Stuck a breakpoint in an update loop on one of my mono behaviors and it never got hit. The console log did say:
[VSCode] Debug Port Found (56876)
Doesn't seem to have actually worked? Anything else I need to do?
Did you go to the debug tab in VSCode and hit the play button there?
Yes, but I get a missing app.js error. Is that generated by the plugin?
launch: program '/Users/mathe015/Repositories/MatchThreeMoji/app.js' does not exist
It also doesn't look like the plugin is writing to Launch.json, which still looks like this:
"name": "Attach",
"type": "node",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858,
"sourceMaps": false
Is that something I have to modify manually?
That is strange ... what version of Visual Studio Code are you using?
In Visual Studio Code 0.8.0, they moved the configuration directory, and the latest pull of my plugin has that, there is a previous release on the repo (https://github.com/dotBunny/VSCode/releases/tag/1.6.5) marked for Visual Studio Code < 0.7.2. It isn't as awesome as the latest version :) but it should work if that's the case.
You should never have to do that manually if the system is working properly ... I should add some more debug log messages for cases. If you are using the older version it probably made the .settings folder for you and put a launch.json file in there too ... but since the older version of Visual Studio Code doesn't know about that folder yet ... boo-urns.
Just updated to 0.8.0 and it works now. Might be a good thing to mention in the readme?
Thanks for all the help!
No problem :) had me worried for a little bit.
I'll put a note in the README right now.
Looks like this process broke code completion in MonoDevelop. Is there a way to have both MonoDevelop and VSCode live alongside each other in peace and harmony?
I believe so, I have to experiment with it a bit ...
Unity 5.2, I believe is where the feature shows up, that allows you to force the type of project / solution files that are saved out, and that would remove the need for me to scrub them.
This would then allow for the project file to be left in a state that MonoDevelop/Xamarin could use them
One option is to simply disable the integration from the menu, the generated project file should then work with MD.
Integration is not checked. Still getting no code completion/highlighting and strange "text editor error"s in MD.
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDevelop.CSharp.Completion.CSharpCompletionTextEditorExtension.GetParameterCompletionCommandOffset (System.Int32& cpos) [0x00000] in /home/builduser/buildslave/monodevelop/build/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs:524
Hmm ... is that Unity's included MonoDevelop?
Yup!
You just can't win :(
I double checked and MD, included with Unity does have its own version of the mono.framework, and to make matters worse, that chunk of code looks to be commented out in the latest versions of MD.
Just use VS Code? :)
Haha, I'm doing so now. I'm running into some auto complete problems however - some Unity system functions aren't completed, and go to file (command+P) seems to have to do a search every time I ask it to go somewhere. For instance, it wasn't able to autocomplete Debug.Log just now.
Erm, I also seem to have lost my go to declaration and all that, though I'm not getting any OmniSharp errors.
Its a bug I just found I'm committing a fix momentarily.
Just grabbed latest (8:43 PST), doesn't seem to have fixed it. Where'd my code complete go :( VSCode doesn't even recognize the Time class and such things cry
Not sure, I just checked and its still working for me ..did you play with the workspace exclusions by chance?
May need to write out new ones (which contain the solution and project files)
My workspace settings:
{
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/*.booproj": true,
"**/*.csproj": true,
"**/*.pidb": true,
"**/*.sln": true,
"**/*.suo": true,
"**/*.user": true,
"**/*.userprefs": true,
"**/*.unityproj": true,
"**/*.dll": true,
"**/*.exe": true,
"**/*.gif": true,
"**/*.ico": true,
"**/*.jpg": true,
"**/*.jpeg": true,
"**/*.mid": true,
"**/*.midi": true,
"**/*.pdf": true,
"**/*.png": true,
"**/*.psd": true,
"**/*.tga": true,
"**/*.tif": true,
"**/*.tiff": true,
"**/*.wav": true,
"**/*.asset": true,
"**/*.cubemap": true,
"**/*.flare": true,
"**/*.mat": true,
"**/*.meta": true,
"**/*.*.meta": true,
"**/*.pidb.meta": true,
"**/*.prefab": true,
"**/*.unity": true,
"**/*.3ds": true,
"**/*.3DS": true,
"**/*.fbx": true,
"**/*.FBX": true,
"**/*.lxo": true,
"**/*.LXO": true,
"**/*.ma": true,
"**/*.MA": true,
"**/*.obj": true,
"**/*.OBJ": true,
"build/": true,
"Build/": true,
"library/": true,
"Library/": true,
"obj/": true,
"Obj/": true,
"ProjectSettings/": true,
"temp/": true,
"Temp/": true
}
}
Yup, as I suspected.
https://github.com/dotBunny/VSCode/commit/a69432231c40fa2fdc7816c73919ae82e0e4f2df
Got rid of an issue where hidding solution and project files caused Visual Studio Code not to work right.
If you write out your workspace settings again it should fix that (with the latest)
That did it! Thanks!
VSCode did tell me that some things did not finish loading properly and when I clicked show Output, it tossed me to the OmniSharp log, the top part of which is this:
[INFO] Starting OmniSharp at '/Users/mathe015/Repositories/myProject/myProject-csharp.sln'...
[INFO] Started OmniSharp from '/Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/omnisharp' with process id 54691...
[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location '/Users/mathe015/Repositories/myProject' on host 54667.
[ERROR:OmniSharp.Dnx.DnxPaths] The specified runtime path 'default' does not exist. Searched locations /Users/mathe015/.dnx/runtimes/dnx-mono.default
/Users/mathe015/.dnx/runtimes/kre-mono.default
/Users/mathe015/.dnx/packages/KRE-Mono.default
/Users/mathe015/.k/runtimes/dnx-mono.default
/Users/mathe015/.k/runtimes/kre-mono.default
/Users/mathe015/.k/packages/KRE-Mono.default
/Users/mathe015/.kre/runtimes/dnx-mono.default
/Users/mathe015/.kre/runtimes/kre-mono.default
/Users/mathe015/.kre/packages/KRE-Mono.default.
Visit https://github.com/aspnet/Home for an installation guide.
Anything I should be concerned about?
I've seen that Dnx path error pop up before, i dont believe its harmful ... but it is interesting that you are seeing it still.
It might be related to Visual Studio Codes bundled apps (https://github.com/OmniSharp/omnisharp-roslyn/issues/249) ... not exactly sure.
Gotcha. Good to know.
Debugging is working afaik, but it looks like hovering over a value doesn't do anything for member variables (class scope)? Locals work fine. The docs say you can inspect that way. Would that be a VSCode issue or could this integration be the cause?
You know I was worried for a moment ...
You need to make sure to set the external editor in Unity to the Visual Studio Code app for it to work it seems, I'll see about adding something that does that for you :) I think thats a failsafe on their part so the process doesn't get unexpectedly high jacked.
Automatic support for this should be coming today, just have to finish up saving/restoring old when you disable the integration.
Just pulled latest - doesn't look like my External Script Editor changed. Changing it manually to VSCode also didn't fix the hover inspection problem (local variables still work).
I've also been getting a lot of Unity lock ups when debugging. I don't have specific repro steps yet, but will work on getting you some. It's usually when I try and hit resume in VSCode.
I definately am going to need some reproduction steps on the External Editor Script test --- but it might be possible that you didn't turn off the integration and then turn it back on (its during the enable/disable process that it rights those changes).
But this does bring a good point up, if enabled I should enforce those settings always. noted
As for the lockups, ive seen them too ... i mean i know you cant go back to Unity till you resume/etc from VSCode. I suspect this might be a Visual Studio Code issue.
Your right hovering over I havent seen for debuggin, the local variables still work ... are you adding watches?
It is odd ... but i think its Visual Studio Code's end
Yeah, there are other oddities. I just hit a breakpoint that I had turned off a while ago, and then when I tried to hit resume in VSCode, nothing happened. I hit stop in VSCode, and it released and went "blue", but Unity stayed stuck and now I have to restart it ;(
I think this debugging hang up piece is the last thing that I need to really jump on board with VSCode as my main code editor for Unity. Any ideas?
I'm going to pass this little problem up the Visual Studio Code chain :)
It is almost like they are not sending the "stop debugging" command back to Unity.
Awesome. Keep me updated!
https://vimeo.com/dotbunny/vscode
I was shooting this and even captured the hang in there :(
@reapazor had my coworker install the plugin from scratch - his external code editor changed automatically and everything, but it doesn't look like omnisharp finds his project automatically i.e. it says pick a project and his autocomplete doesn't work at all. I was so evangelical about the plugin too ;(
@reapazor I'm also not able to look into the contents of a List when I debug - it displays this error instead:
This request is not supported by the protocol version implemented by the debuggee.
I am able to use the debug console to see individual elements by i.e. myList[0] but that's obviously really tedious if I need to look at all the contents of the list.
@vexir Is there any spaces in the project path ?
As for the list, that would be something for the Visual Studio Code team.
No spaces. The code completion is working for me, just not for my coworker. Not sure what's different about our installations.
Eshan
On Sep 8, 2015, at 12:27 PM, Matthew Davey notifications@github.com wrote:
@vexir Is there any spaces in the project path ?
As for the list, that would be something for the Visual Studio Code team.
— Reply to this email directly or view it on GitHub.
Whats your path to your project, unity and vscode .... whats his?
I've seen random occasions where VSCode didnt work, but then a force sync fixed it.
Mine:
/Applications/Visual Studio Code.app
/Applications/Unity/Unity.app
~/Repositories/myProject/
His:
/Applications/Visual Studio Code.app
/Applications/Unity/Unity.app
~/code/myProject/
Might be worth noting that when trying to manually select projects, we picked one of the .sln files and since then (even through relaunches of VSCode) his "flame" icon has been fading in and out and become unclickable.
Any thing fancy (special characters?) in your user names?
Nope. Letters and numbers, no spaces.
On Tue, Sep 8, 2015 at 4:05 PM, Matthew Davey notifications@github.com wrote:
Any thing fancy (special characters?) in your user names?
— Reply to this email directly or view it on GitHub https://github.com/dotBunny/VSCode/issues/2#issuecomment-138727264.
Looks like OmniSharp can't start, so many features aren't working? My log: