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

NullReferenceException in `dotnet try verify` #299

Open
Falco20019 opened this issue Jun 24, 2019 · 2 comments

Comments

@Falco20019
Copy link

commented Jun 24, 2019

Describe the bug

I created a new demo with dotnet try demo and tried to do a dotnet try verify. I only get an exception as follows.

Did this error occur while using dotnet try or online?

  • dotnet-try
  • online

What kind of error was it?

  • User Interface (UI): For example the output never displayed
  • Service Error: For example "The service is temporarily unavailable. We are working on it"
  • Other: NullReferenceException

Screenshots

C:\Users\dejhbk0l\Desktop\myTutorial>dotnet --list-sdks
2.1.700 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
3.0.100-preview6-012264 [C:\Program Files\dotnet\sdk]

C:\Users\dejhbk0l\Desktop\myTutorial>dotnet tool list --global
Package Id      Version          Commands
-------------------------------------------
dotnet-try      1.0.19317.5      dotnet-try

C:\Users\dejhbk0l\Desktop\myTutorial>dotnet try demo
Hosting environment: Production
Content root path: C:\Users\dejhbk0l\Desktop\myTutorial
Now listening on: https://localhost:55183
Application started. Press Ctrl+C to shut down.
Application is shutting down...

C:\Users\dejhbk0l\Desktop\myTutorial>dotnet try verify
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at WorkspaceServer.PackageRegistry.CreateForTryMode(DirectoryInfo project, PackageSource addSource) in F:\workspace.1\_work\1\s\WorkspaceServer\PackageRegistry.cs:line 169
   at MLS.Agent.CommandLine.CommandLineParser.<>c.<Create>b__7_2(VerifyOptions verifyOptions, IConsole console, StartupOptions startupOptions) in F:\workspace.1\_work\1\s\MLS.Agent\CommandLine\CommandLineParser.cs:line 91
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at MLS.Agent.CommandLine.CommandLineParser.<>c.<<Create>b__7_3>d.MoveNext() in F:\workspace.1\_work\1\s\MLS.Agent\CommandLine\CommandLineParser.cs:line 131
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass3_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()

C:\Users\dejhbk0l\Desktop\myTutorial>

Please complete the following:

  • OS
    • Windows 10 v1803
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Commandline
    • cmd
@BillWagner

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

@Falco20019 I may have a workaround (because I've run into something similar myself).

dotnet try verify requires a director argument. Try dotnet try verify . (Note the additional '.')

@Falco20019

This comment has been minimized.

Copy link
Author

commented Jun 24, 2019

Super fast response and working workaround :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.