-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unable to run dotnet core application on Mac using dotnet command, but works under vscode #8529
Comments
@danwalmsley can you share your csproj. Also, please share the contents of dotnet --info when it is executed in both the console in VS code and the bash terminal. Also, keep in mind that the CLI does not support XMAL. |
@livarcocc sure no problem, project is on GitHub located here:
|
@steveharter I ran the uninstall dot net script it output the following: so there are all the dotnet versions that were installed. |
we built our own XAML framework ;) see here: https://github.com/AvaloniaUI/Avalonia |
@livarcocc @steveharter I still get the issue: here is the log file with only .net core 2 installed. |
@danwalmsley I followed the instructions above, and got this:
Are there additional dependencies? Gtk? |
ah yes, you need to install gtk3, instructions are:
|
Any updates on this? |
@livarcocc @steveharter @janvorli hoping to find a solution to this still, did you guys find out what may be the problem? |
I was able to repro the issue. It works with integrated VSCode console, fails with raw console or external console.
|
@janvorli what do you suggest in terms of additional debugging from CLR side? Is there a way to enable diagnostics to see additional information on assembly loading failure (location, version)? Thanks |
@steveharter the "A device attached to the system is not functioning" could lead us to figure out the culprit. Could you please run it under |
You can also try to set the COREHOST_TRACE env var to 1 and see what it dumps. |
@DustinCampbell since it works in vscode, he may be able to tell us if there is anything different there. |
@danwalmsley: Could you set |
Adding @gregg-miskelly since this is really about running under the VS Code debugger (where it works). @danwalmsley: You can disregard my request above. |
Here's the dtrace output dtraceoutput.txt. Nothing special about the System.Text.Encoding.Extensions assembly there that I saw. The method that is failing System.Xml.XmlTextReaderImpl.DetectEncoding() does nothing special except reference some encoding classes including UnicodeEncoding and UTF8Encoding which are located in System.Text.Encoding.Extensions reference assembly (which is failing to load), with its implementation in core. Is it possible that the contract for these classes is not consistent \ correct (I didn't verify yet). Other possibilities? |
If you want to get a dtrace while running under the debugger -- there is no way to directly spawn the process both under dtrace and under the debugger at the same time. If dtrace supports attach you could try pausing the process at startup (ex: hitting a breakpoint), going to a separate command window and attaching with dtrace, and then continuing. All the debugger will be doing is running the equivalent of |
@gregg-miskelly I took the dtrace outside the debugger which is the failure case. Since there was nothing out of place in the dtrace log for the failing assembly, I don't plan on running dtrace under the debugger. Thanks. |
@steveharter have you also tried my second suggestion - set the COREHOST_TRACE env var to 1 and see what the dotnet command dumps when you try to run the failing app? |
@janvorli yes I ran with COREHOST_TRACE=1 with nothing obvious. Note also danwalmsley linked his output earlier in this issue. Also I compared the tail end of the trace output with the output from running within the integrated terminal (success case) and didn't see any differences except for the exception. Here's the tail end:
|
Going forward, I'll attempt a simple repro on the box trying to trigger\reference the failing assembly. If that doesn't lead to anything, I will likely do a local build of coreclr and debug that. |
I have just realized that the error message has nothing to do with a device not being functioning. It is the generic ERROR_GEN_FAILURE that is reported when something fails and there is no suitable error code for that. There are just a few places where we generate such a code. We can ignore majority of those that are generated during PAL initialization and so there seem to be only two places left. I would recommend building coreclr from the same commit as the one that's being used now was built from (run |
@DustinCampbell, I assume the log is stored as a file? Where at? (didn't see it in stdout or stderr) |
Success! @janvorli with the custom coreclr, the error was indeed at the third location you thought it would be (FILEGetLastErrorFromErrno) and was returning:
I then ran from within my test console:
to bump the max number of open files from 256 to 512, which resulted in the success case of the AvalonStudio window in opening. |
Next steps? Add a release note? Make a call to |
@steveharter Great! |
I've looked into the
|
@anwalmsley could you please check if e.g. it |
@janvorli hey, sorry I didn't notice this thread, I will try and run the test this week. Thanks for all your efforts in diagnosing and fixing :) |
@danwalmsley any updates on this repro? |
I am going to close this issue since this seems like a too many files open problem and the fix is not in the CLI but in the CoreCLR, if I read this thread right. If that's not the case, please comment or re-activate. @danwalmsley thanks for reporting and @janvorli and @steveharter thanks for investigating. |
@danwalmsley commented on Tue Jul 11 2017
Basically I have an application written for netcoreapp2.0
It runs perfectly via vscode debugger with setting
"console": "internalConsole"
(I mention this as it may be a clue to what is happening)If I tell vscode to use external console or...
If I run it through the terminal on mac and do dotnet ./myapp.dll
I starts to load and crashes with
How can it be the case it works under vscode terminal but not bash? How can I get more verbose output that could help you guys diagnose the issue?
@gkhanna79 commented on Wed Jul 12 2017
@steveharter should be able to help out here.
@danwalmsley commented on Fri Jul 14 2017
Thanks! I have the feeling, vscode is using an internal console and its environments / paths, etc is correct, when I use bash something is missing ands its not able to resolve assemblies.
@steveharter commented on Fri Jul 14 2017
@danwalmsley try
export COREHOST_TRACE=1
and run again to get verbose output. This will tell you where it is looking for the runtime and related assemblies.It is possible that the version of System.Text.RegularExpressions that is found is older.
@danwalmsley commented on Fri Jul 14 2017
@steveharter i will try on Monday when I'm in front of the affected system and post back. Thanks
@danwalmsley commented on Mon Jul 17 2017
OK so here is the result:
firstly contents of directory:
@danwalmsley commented on Mon Jul 17 2017
The error message when I run the application normally. It can't find AvaloniaEdit.dll, which is included (see prev post with dir listing)
@danwalmsley commented on Mon Jul 17 2017
log.txt
log is very long so put it in the attached text file.
@steveharter commented on Mon Jul 17 2017
Do you know why the error message changed from failing to load
System.Text.RegularExpressions
toAvaloniaEdit
? Does it still work under different vscode settings?The triggering exception appears to be OmniXaml.LoadException, wrapping a System.IO.FileLoadException for AvaloniaEdit.dll. From the log, that assembly appears to be found by CoreClr at
/Users/richard/avalon/AvalonStudio/AvalonStudio/AvalonStudio/bin/Debug/netcoreapp2.0/osx.10.12-x64/AvaloniaEdit.dll
.However I would guess that OmniXaml is doing a custom load of the AvaloniaEdit.dll and is not using the same directory as CoreClr to find that assembly. Perhaps it needs to intercept the assembly resolving events?
Other misc from the log:
App base location:
/Users/richard/avalon/AvalonStudio/AvalonStudio/AvalonStudio/bin/Debug/netcoreapp2.0/osx.10.12-x64
App location:
Users/richard/avalon/AvalonStudio/AvalonStudio/AvalonStudio/bin/Debug/netcoreapp2.0/osx.10.12-x64/AvalonStudio.dll
Launch host:
/usr/local/share/dotnet/dotnet
JIT_PATH:
/Users/richard/.nuget/packages/runtime.osx-x64.microsoft.netcore.app/2.0.0-preview2-25407-01/runtimes/osx-x64/native/libclrjit.dylib
Probing directory:
/Users/richard/.nuget/packages/
with several subdirectories (not complete):lib/netstandard1.1
Avalonia.Direct2D1/0.5.1-build3417-alpha
avalonia.direct2d1/0.5.1-build3417-alpha/lib/net45
Avalonia.Gtk3/0.5.1-build3417-alpha
avalonia.win32/0.5.1-build3417-alpha/lib/netstandard1.1
Avalonia.Skia.Desktop/0.5.1-build3417-alpha
avalonia.skia.desktop/0.5.1-build3417-alpha/lib/netstandard1.3
Avalonia.Xaml.Behaviors/0.5.0
avalonia.xaml.behaviors/0.5.0/lib/netstandard1.1
avalonia/0.5.1-build3417-alpha/lib/netcoreapp1.0/
@danwalmsley commented on Thu Jul 20 2017
@steveharter sorry for delay, my colleague with mac is away, so I will come back to you once we have access to mac, to give you more information. Thanks Dan
@danwalmsley commented on Mon Jul 24 2017
@steveharter Ok I don't know why the error message changed, i rebuilt from scratch and the error went back to original one. I have attached a new log file, and linked a youtube video so you can see what is happening.
youtube shows me using the console in vscode to invoke the app, and it working.
then me using terminal, and it not working.
avalonstudio.txt
https://www.youtube.com/watch?v=v8C_aJm6WTg&feature=youtu.be
thanks for your patience as I have been slow to respond.
@steveharter commented on Mon Jul 24 2017
From the log, it looks like a previous version of dotnet was installed as it is finding the dotnet executable version 1.0.1 instead of 2.0 preview version. Although I'm not aware of any problems with this (as it should be in "muxer" mode and just forward to the 2.0 preview location) can you please try to replace the dotnet executable with the 2.0 version? At least we can rule that out and then go from there. Thanks.
The text was updated successfully, but these errors were encountered: