0xf005ba11 / vmplex-ws

A tabbed UI for Microsoft's Hyper-V
MIT License
205 stars 15 forks source link

Crash when no VMs are in Hyper-V #39

Closed 0xf005ba11 closed 1 year ago

0xf005ba11 commented 1 year ago

image

jxy-s commented 1 year ago

From twitter thread: https://twitter.com/MouriNaruto/status/1646704801403772928?s=20

I have tried several versions of VMPlex in GitHub Releases, I found it cannot show the VM which is created in VMPlex GUI after I restart the VMPlex process. Also, I found VMPlex will crash when no VMs in Hyper-V or using Hyper-V Manager to remove VMs.

image

Additional crash information for launching clean VMPlex instance (extracted from the release zip package) when no VMs in Hyper-V.

image

MouriNaruto commented 1 year ago

I will subscribe this issue and hope it to be resolved.

Kenji Mouri

jxy-s commented 1 year ago

@MouriNaruto I was able to reproduce the crash. The above fix should resolve it.

I found VMPlex will crash when no VMs in Hyper-V or using Hyper-V Manager to remove VMs.

This should be resolved with https://github.com/0xf005ba11/vmplex-ws/pull/41

I found it cannot show the VM which is created in VMPlex GUI after I restart the VMPlex process.

I could not reproduce this. Could you provide more detailed steps to reproduce?

MouriNaruto commented 1 year ago

@jxy-s I have tested the main branch. The issue (I found VMPlex will crash when no VMs in Hyper-V or using Hyper-V Manager to remove VMs.) is resolved.

image

For that issue (I found it cannot show the VM which is created in VMPlex GUI after I restart the VMPlex process.), I will provide more information because I found I met an exception shown in Visual Studio debugger when creating a VM via VMPlex. Please wait. I will reply that information to this issue.

Kenji Mouri

jxy-s commented 1 year ago

Thank you Kenji! ❤️ - I appreciate you verifying the fix. I look forward to your analysis. If you know where the problem is, feel free to put up a PR to address it.

MouriNaruto commented 1 year ago

@jxy-s

I found I met an exception shown in Visual Studio debugger when creating a VM via VMPlex.

Exception thrown: 'System.InvalidOperationException' in WindowsBase.dll
An exception of type 'System.InvalidOperationException' occurred in WindowsBase.dll but was not handled in user code

Here is the video.

2023-04-14 12-11-01.zip

Kenji Mouri

jxy-s commented 1 year ago

Thanks for the details and video. My guess is maybe this is a localization issue? Based on your previous screenshot it seems like there is no VM showing up in the Hyper-V manager either. Is that still the case? Also, if you create the VM through the Hyper-V manager does it show up in VMPlex?

MouriNaruto commented 1 year ago

@jxy-s

Based on your previous screenshot it seems like there is no VM showing up in the Hyper-V manager either.

That screenshot is for validating the issue (I found VMPlex will crash when no VMs in Hyper-V or using Hyper-V Manager to remove VMs.) is fixed.

Here is the screenshot for "I found it cannot show the VM which is created in VMPlex GUI after I restart the VMPlex process.":

image

Also, if you create the VM through the Hyper-V manager does it show up in VMPlex?

I tried create a VM via VMPlex because the VMs created by Hyper-V Manager will not show up in VMPlex.

Kenji Mouri

jxy-s commented 1 year ago

👍 thanks for clarifying. When you encounter that exception, could you capture a dump file (Debug > Save dump as...)? If you do, please send me that dump file including the symbol files. You may email me if you can't upload it here (johnny.shaw@live.com).

MouriNaruto commented 1 year ago

@jxy-s I finally find the issue.

In VMPlex.VMManager.GetVMs method:

image

The value of vm.Caption will be localized in non-English Windows instance.

Kenji Mouri

jxy-s commented 1 year ago

@MouriNaruto thanks for digging in to this ❤️ . We will investigate if there is an alternative. cc @0xf005ba11

jxy-s commented 1 year ago

The purpose of that list is to filter out the host systems from the list ("Hosting Computer System", "Hosting Computer System"). Looking over the alternatives:

  1. InstallDate looks to be {1/1/0001 12:00:00 AM} for the host system (similarly for other dates in the object).
  2. EnhancedSessionModeState looks to maybe be an erroneous/undocumented value (is set to 0):
        public enum EnhancedSessionMode : ushort
        {
            AllowedAndAvailable = 2,
            NotAllowed = 3,
            AllowedButUnavailable = 6
        }
jxy-s commented 1 year ago

@MouriNaruto a fix was merged that should address the issue you were having. Please let us know if the issue continues.

MouriNaruto commented 1 year ago

@jxy-s

image

I have confirmed that issue has been fixed.

Kenji Mouri