monodevelop-dnx-addin icon indicating copy to clipboard operation
monodevelop-dnx-addin copied to clipboard

Poor error messages when dotnet fails to initialize

Open mhutch opened this issue 8 years ago • 2 comments

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 avatar Jun 13 '16 19:06 mhutch

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

mhutch avatar Jun 13 '16 19:06 mhutch

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.

mrward avatar Jul 06 '16 21:07 mrward