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

Poor error messages when dotnet fails to initialize #30

Open
mhutch opened this issue Jun 13, 2016 · 2 comments
Open

Poor error messages when dotnet fails to initialize #30

mhutch opened this issue Jun 13, 2016 · 2 comments
Milestone

Comments

@mhutch
Copy link

mhutch commented Jun 13, 2016

I'm filing this as a single issue, even though it could be broken down into a number of smaller bugs, as they're interrelated.

I installed the addin and created a project.

Issue 1: I didn't have .NET Core installed, and there were no error messages telling me how to fix this.

I then installed .NET Core, following all the instructions (including OpenSSL), and created a project.

The status area showed 3 errors. When I clicked on it, it showed the error pad, with the following errors:

/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.lock.json(0,0): Error NU1009: The expected lock file doesn't exist. Please run "dotnet restore" to generate a new lock file. (NU1009)
/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json(29,29): Error NU1001: The dependency Microsoft.NETCore.App >= 1.0.0-rc2-3002702 could not be resolved. (NU1001)
/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json(29,29): Error NU1001: The dependency Newtonsoft.Json >= 8.0.3 could not be resolved. (NU1001)

Issue 2: It was very difficult to select the errors to copy them, as they would deselect every few seconds.

Issue 3: When I closed the project, the errors did not go away. Each time I closed and reopened it, an additional set of the same errors was added.

Issue 4: When I built the project, I would sometimes get a "build succeeded" message, despite the long pad showing errors.

Issue 5: The build log didn't show any useful error information. It didn't even show the errors.

Building Solution: HelloDotNetCore (Debug)
Project HelloDotNetCore does not have a lock file.
Project HelloDotNetCore does not have a lock file.
The application was terminated by a signal: SIGHUP

---------------------- Done ----------------------

Xamarin Inspector Integration
    Enabled for project: no
        Reason: Inspector does not support this project type
    Version: 0.9.0.0
    Hash: d7fade8

Build: 1 error, 0 warnings

Issue 6: The "Restoring" message in the solution pad was blinking on and off.

Issue 7: The "restoring" message and its error never showed up in the status area.

Issue 8: XS was using 100% CPU indefinitely.

When I checked the log, I saw the following message repeated a huge amount of times. Presumably the cause of issues 2, 6 and 8 is that XS is continuously retrying to restore the packages.

OnSend ((e61c2215-4307-4e78-80eb-c7f1c4db8dc0, DependencyDiagnostics, 1) -> {
  "Framework": {
    "FrameworkName": ".NETCoreApp,Version=v1.0",
    "FriendlyName": ".NETCoreApp,Version=v1.0",
    "ShortName": "netcoreapp1.0",
    "RedistListPath": null
  },
  "Errors": [
    {
      "ErrorCode": "NU1009",
      "SourceFilePath": "/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.lock.json",
      "Message": "The expected lock file doesn't exist. Please run \"dotnet restore\" to generate a new lock file.",
      "Severity": 2,
      "StartLine": 1,
      "StartColumn": 0,
      "EndLine": 1,
      "EndColumn": 0,
      "FormattedMessage": "/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.lock.json(1,0): error NU1009: The expected lock file doesn't exist. Please run \"dotnet restore\" to generate a new lock file.",
      "Source": null
    },
    {
      "ErrorCode": "NU1001",
      "SourceFilePath": "/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json",
      "Message": "The dependency Microsoft.NETCore.App >= 1.0.0-rc2-3002702 could not be resolved.",
      "Severity": 2,
      "StartLine": 7,
      "StartColumn": 29,
      "EndLine": 7,
      "EndColumn": 29,
      "FormattedMessage": "/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json(7,29): error NU1001: The dependency Microsoft.NETCore.App >= 1.0.0-rc2-3002702 could not be resolved.",
      "Source": {
        "Name": "Microsoft.NETCore.App",
        "Version": "1.0.0-rc2-3002702"
      }
    },
    {
      "ErrorCode": "NU1001",
      "SourceFilePath": "/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json",
      "Message": "The dependency Newtonsoft.Json >= 8.0.3 could not be resolved.",
      "Severity": 2,
      "StartLine": 11,
      "StartColumn": 29,
      "EndLine": 11,
      "EndColumn": 29,
      "FormattedMessage": "/Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json(11,29): error NU1001: The dependency Newtonsoft.Json >= 8.0.3 could not be resolved.",
      "Source": {
        "Name": "Newtonsoft.Json",
        "Version": "8.0.3"
      }
    }
  ],
  "Warnings": []
})

When I ran dotnet restore in the terminal, I finally found the real issue:

saturn:HelloDotNetCore mikayla$ dotnet restore
log  : Restoring packages for /Users/mikayla/Projects/HelloDotNetCore/src/HelloDotNetCore/project.json...
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error:   The type initializer for 'Crypto' threw an exception.
error:   The type initializer for 'CryptoInitializer' threw an exception.
error:   Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.
error:    (Exception from HRESULT: 0x8007007E)

Issue 9: the above information was not shown anywhere in XS.

@mhutch
Copy link
Author

mhutch commented Jun 13, 2016

Note: the actual issue was that my OpenSSL was out of date.

mrward added a commit that referenced this issue Jun 26, 2016
If a dependency cannot be resolved then package restore would
repeatedly be triggered. The original OmniSharp code would start a
package restore if dependencies were unresolved. Then after the
restore process exits a RestoreCompleted message was sent to the
design time host. The design time host then sends another message
back indicating that dependencies are not resolved. This again
triggers the package restore to be run.

The DnxProjectSystem has been changed so it does not try to
restore if there are missing dependencies. Now the DnxProject itself
will trigger restore if there are missing dependencies only the once
after a project has been opened. This prevents the restore from being
triggered repeatedly due to missing dependencies.

#30 (Issue 2, 6 and 8)
mrward added a commit that referenced this issue Jun 26, 2016
On closing the solution errors due to invalid dependencies or build
errors were not cleared since the build errors and tasks did not
have the XProject as their owner.

#30 (Issue 3)
mrward added a commit that referenced this issue Jun 26, 2016
When restoring packages the status bar will now show a "Restoring
dependencies..." message. If this fails then an error message will be
displayed in the status bar. Clicking the status bar will open the
.NET Core Output window which will show the output from the restore
process.

#30 (Issue 7 and 9)
mrward added a commit that referenced this issue Jul 4, 2016
If the dotnet executable cannot be found then an error message will
be displayed with information about where the .NET Core SDK can be
downloaded from.

Bug #30 (Issue 1)
@mrward mrward added this to the 0.5 milestone Jul 6, 2016
@mrward
Copy link
Owner

mrward commented Jul 6, 2016

Hopefully all these issues apart from two are fixed in version 0.5.

Issue 4: When I built the project, I would sometimes get a "build succeeded" message, despite the long pad showing errors.

I could not reproduce the build succeeded message being displayed when the lock file was missing. The build would always fail.

Issue 5: The build log didn't show any useful error information. It didn't even show the errors.

If the lock file is empty the only error you get from the dotnet build is that the lock file is missing. The other errors are from the design time host. Hopefully with the other fixes the underlying error should be displayed so the build not showing this error should not be a problem.

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

2 participants