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

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. #14

Closed
RossBencina opened this issue Dec 18, 2017 · 2 comments

Comments

@RossBencina
Copy link

Hi. I'm getting the above error when trying to run .\LxRunOffline.exe list or .\LxRunOffline.exe install. Full log is below. I downloaded the .zip version of LxRunOffline. Here are my system specs:

  • Windows 10 Pro
  • Version 1709
  • OS Build 16299.64

Windows Developer Mode was already enabled and I ran Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux and rebooted before trying LxRunOffline.

I have not previously tried to install any distributions using other WSL installers.

Here is is my PS session. PS was run as administrator.

PS C:\LxRunOffline-v2.1.1> .\LxRunOffline.exe help
LxRunOffline 2.1.1
Copyright (C) 2017 DDoSolitary

  list                List all installed distributions.

  default             Get or set the default distribution, which is used by bash.exe.

  install             Install a new distribution.

  register            Register an existing installation directory.

  uninstall           Uninstall a distribution

  unregister          Unregister a distribution but not delete the directory containing it.

  move                Move a distribution to a new directory.

  run                 Run a command in a distribution.

  dir                 Get the installation directory of a distribution.

  config-env          Get or set the default environment variables of a distribution. (Currently unusable because of a
                      problem of the command line parser library.)

  config-uid          Get or set the UID of the default user of a distribution.

  config-kernelcmd    Get or set the default kernel command line of a distribution.

  config-flag         Get or set some flags of a distribution. See
                      https://msdn.microsoft.com/en-us/library/windows/desktop/mt826872(v=vs.85).aspx for details.

  help                Display more information on a specific command.

  version             Display version information.

PS C:\LxRunOffline-v2.1.1> .\LxRunOffline.exe list

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at LxRunOffline.Wsl.<ListDistros>d__6.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at LxRunOffline.Program.<>c.<Main>b__0_0(ListOptions opts)
   at LxRunOffline.Program.Main(String[] args)
PS C:\LxRunOffline-v2.1.1-B> .\LxRunOffline.exe install -n wsl-ubuntu-16.04.2 -f "F:\Archived Installers\OS Images For W
SL\16.04.2-server-cloudimg-amd64-root.tar.gz" -d c:\wsl-ubuntu-16.04.2

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at LxRunOffline.Wsl.FindDistroKey(String distroName, Boolean write)
   at LxRunOffline.Wsl.InstallDistro(String distroName, String tarGzPath, String targetPath)
   at LxRunOffline.Program.<>c.<Main>b__0_2(InstallOptions opts)
   at LxRunOffline.Program.Main(String[] args)
PS C:\LxRunOffline-v2.1.1>
@DDoSolitary
Copy link
Owner

It is because new Windows installations doesn't have registry keys that LxRunOffline tries to read. I'll fix it ASAP. For now you can save following content to a .reg file and double click the file to import it to the registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss]
"DefaultDistribution"=""


@RossBencina
Copy link
Author

Thank you! It seems to be working now :)

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