Windows Server 2012 and Windows 8 support Hyper-V 3+, but Hyper-V 3+ changed something such as compact virtual hard disk file no more work if you do not do extra steps: attach virtual hard disk file and detach again.
The following are steps in Windows 8.
1: Try to find Disk Management in Windows 8 and run it:
2: Menu Action \ Attach VHD to attach a virtual hard disk file:
(Please make sure this virtual hard disk is NOT in use, so if your virtual machine is running, stop it first)
You MUST check on “Read-only”:
3: After you attached VHD, you should see new disk in Disk Management:
4: Now go back to Hyper-V management to do regular Hyper-V hard disk compact process
You should see the following processing screen, otherwise,
You can also use PowerShell command to the same compact step:
5: After compact, please remember to go back to Disk Management to detach VHD
Actually, for my case, the .vhdx file size did not change enough, maybe my .hdvx file is a new generated file, but you can try using above steps for your case.