babalae / better-genshin-impact

📦BetterGI · 更好的原神 - 自动拾取 | 自动剧情 | 全自动钓鱼(AI) | 全自动七圣召唤 | 自动伐木 | 自动刷本 | 自动采集 - UI Automation Testing Tools For Genshin Impact
https://bgi.huiyadan.com/
GNU General Public License v3.0
4.92k stars 310 forks source link

程序异常 Microsoft.Extensions.Logging #150

Closed uprprc777 closed 8 months ago

uprprc777 commented 9 months ago

BetterGI version: 0.18.0

I am playing GI international but the game is set to Simplified Chinese.

108978fab0226eba413903e658

When I hit "启动", this error message pops up. It says, "程序异常 Microsoft.Extensions.Logging" and some debug info.

BetterGI cannot be activated and does nothing!

Older versions like 0.17.1 don't have this issue.

huiyadanli commented 9 months ago

I can't pinpoint what's causing this problem, but what's causing it must have something to do with the BetterGI's log output.

Try manually creating a folder named log in the BetterGI root directory.

uprprc777 commented 9 months ago

Try manually creating a folder named log in the BetterGI root directory.

Tried. It doesn't fix saddly.

Also, I tried removing everything of BetterGI and have a fresh copy of BetterGI. I put BetterGI at C:\Users\my_username\BetterGI, which doesn't require administrator privilege for sure. After I launched BetterGI, the log directory was created automatically and there is a text file inside.

C:\Users\my_username\BetterGI\log\better-genshin-impact20231210.log

[23:50:17.064] [INF] BetterGenshinImpact.ViewModel.MainWindowViewModel
更好的原神 "0.18.0"

[23:50:25.500] [INF] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
当前游戏分辨率1920x1080,素材缩放比率"1.00"

[23:50:25.781] [WRN] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
当前游戏语言TraditionalChinese不是简体中文,部分功能可能无法正常使用

[23:50:25.792] [WRN] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
游戏注册表配置信息读取失败:Microsoft.Extensions.Logging
--
   at Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(ILogger logger, String message, Object[] args)
   at BetterGenshinImpact.GameTask.TaskTriggerDispatcher.ReadGameSettings() in D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\GameTask\TaskTriggerDispatcher.cs:line 101
---
An error occurred while writing to logger(s). (Cannot open log for source '.NET Runtime'. You may not have write access.)
uprprc777 commented 9 months ago

I would have to go back to 0.17.1 for now...

huiyadanli commented 9 months ago

This is the version of deleting Genshin Impact registry information check, please try again.

https://mypikpak.com/s/VNlOfwe9kGcwV2ZNNMKdYg8po1

uprprc777 commented 9 months ago

This is the version of deleting Genshin Impact registry information check, please try again.

https://mypikpak.com/s/VNlOfwe9kGcwV2ZNNMKdYg8po1

This seems to working properly. No more strange error prompt and warning message (e.g. game is not Simplified Chinese). And most tasks are functioning though I have not test everything.

uprprc777 commented 9 months ago

This is the version of deleting Genshin Impact registry information check, please try again.

https://mypikpak.com/s/VNlOfwe9kGcwV2ZNNMKdYg8po1

The issue was fixed in this specific version but happens again in 0.19.0!

huiyadanli commented 9 months ago

Please provide the error logs related to 0.19.0

uprprc777 commented 9 months ago

In 0.19.0 this issue behaves a little different from 0.18.1.

In 0.18.1, BetterGI launches normally and the error prompt only pops up when "启动" is pressed.

While in 0.19.0, the error propmt pops up very soon (about 2 secs) after the BetterGI main window appears. If I close the error prompt, the BetterGI will also quit. I could press "启动" as soon as BetterGI main window appears. While the error prompt also pops up, I can close it and BetterGI will not quit. However, BetterGI is still not activated. And if I press "启动" again, everything goes like 0.18.1.

Here is the log.

better-genshin-impact20231223.log

[15:02:25.152] [INF] BetterGenshinImpact.ViewModel.MainWindowViewModel
更好的原神 "0.19.0"

[15:02:26.744] [INF] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
当前游戏分辨率1920x1080,素材缩放比率"1.00"

[15:02:27.240] [WRN] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
当前游戏语言TraditionalChinese不是简体中文,部分功能可能无法正常使用。The game language is not Simplified Chinese, some functions may not work properly

[15:02:27.249] [WRN] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
游戏注册表配置信息读取失败:Microsoft.Extensions.Logging
--
   at Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(ILogger logger, String message, Object[] args)
   at BetterGenshinImpact.GameTask.TaskTriggerDispatcher.ReadGameSettings() in D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\GameTask\TaskTriggerDispatcher.cs:line 102
---
An error occurred while writing to logger(s). (Cannot open log for source '.NET Runtime'. You may not have write access.)

[15:02:31.175] [INF] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
当前游戏分辨率1920x1080,素材缩放比率"1.00"

[15:02:31.282] [WRN] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
当前游戏语言TraditionalChinese不是简体中文,部分功能可能无法正常使用。The game language is not Simplified Chinese, some functions may not work properly

[15:02:31.282] [WRN] BetterGenshinImpact.GameTask.TaskTriggerDispatcher
游戏注册表配置信息读取失败:Microsoft.Extensions.Logging
--
   at Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(ILogger logger, String message, Object[] args)
   at BetterGenshinImpact.GameTask.TaskTriggerDispatcher.ReadGameSettings() in D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\GameTask\TaskTriggerDispatcher.cs:line 102
---
An error occurred while writing to logger(s). (Cannot open log for source '.NET Runtime'. You may not have write access.)
huiyadanli commented 9 months ago

Try this installation package version:

https://mypikpak.com/s/VNmPAw6QnPZf7Eau8xUiXME0o1

uprprc777 commented 9 months ago

Try this installation package version:

https://mypikpak.com/s/VNmPAw6QnPZf7Eau8xUiXME0o1

This version of BetterGI does not crash at startup but still cannot be activated. Same issue as what I had for 0.18.0 (https://github.com/babalae/better-genshin-impact/issues/150#issue-2034295377).

huiyadanli commented 8 months ago

Sorry, I'm afraid I currently lack the capacity to handle this issue.

uprprc777 commented 8 months ago

Recently, I performed a clean reinstallation of Windows for some other reasons. Afterward, I installed Genshin and BetterGI 0.22.0.

This time, BetterGI is functioning properly, and no error prompts are appearing. It seems like this issue has been resolved. I'm uncertain whether the BetterGI update fixed this issue or if there was a problem with my old Windows copy.

huiyadanli commented 8 months ago

In the recent updates of BetterGI, the code that caused the error has not been changed.

huiyadanli commented 2 weeks ago

612

The reason for this phenomenon is that the Windows Event Log service did not start

image