Xcube-Studio / Natsurainko.FluentLauncher

Natsurainko.FluentLauncher A Minecraft launcher designed for Windows 11
https://fluentlauncher.natsurainko.work/
MIT License
304 stars 16 forks source link

[Bug] MemoryUtils.GetWindowsMetrics 的不正常输出 #192

Closed PRO-2684 closed 1 year ago

PRO-2684 commented 1 year ago

Describe the bug

之前是好的,不知道什么时候开始启动任意核心均会出现此问题

Steps to reproduce the bug

启动游戏

Expected behavior

No response

Environment

Windows 11 22H2 Launcher 2.2.3.0

Attachment

Message: Index was outside the bounds of the array.
HelpLink: 
======================================== InnerException:  ========================================
Source: Natsurainko.FluentCore
StackTrace:    at Nrk.FluentCore.Utils.MemoryUtils.GetWindowsMetrics()
   at Nrk.FluentCore.Utils.MemoryUtils.CalculateJavaMemory(Int32 min)
   at Natsurainko.FluentLauncher.Services.Launch.LaunchService.<>c__DisplayClass13_0.<CreateLaunchProcess>b__3()
   at Natsurainko.FluentLauncher.Components.Launch.LaunchProcess.RunLaunch()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

image

natsurainko commented 1 year ago

尝试手动在cmd中执行这条语句 看看输出是怎么样的

powershell -NoLogo -NonInteractive -Command "Get-CIMInstance Win32_OperatingSystem | Select FreePhysicalMemory,TotalVisibleMemorySize | Format-List"

我这里是这样的 image

PRO-2684 commented 1 year ago
FreePhysicalMemory     : 7192808
TotalVisibleMemorySize : 16555320
natsurainko commented 1 year ago

emmmmm 看起来应该没有问题 每次启动的时候都这样吗

PRO-2684 commented 1 year ago

是这样,没法启动任何核心

natsurainko commented 1 year ago

emmmmmm 暂时先把自动设置内存关掉吧 也不太清楚是哪里不对

PRO-2684 commented 1 year ago

还是这个问题,重置以及卸载重装也没有用 image

natsurainko commented 1 year ago

image

继续改了一下获取内存的方式 现在改成直接调win32函数的方法,看看还有没有问题