karaoke-dev / karaoke-resources

Assets used by karaoke!.
Other
0 stars 0 forks source link

Fix "Failed to add ruleset osu.Game.Rulesets.Karaoke.Resources" error in the local run. #9

Open andy840119 opened 2 years ago

andy840119 commented 2 years ago

It's caused by the dll name start with osu.Game.Rulesets. See the RulesetStore in the osu.game.

public abstract class RulesetStore : IDisposable, IRulesetStore
{
    private const string ruleset_library_prefix = @"osu.Game.Rulesets";'
...

Here's the log:

2022-06-08 14:38:10 [verbose]: ⚠️ Failed to add ruleset osu.Game.Rulesets.Karaoke.Resources, Version=2022.608.1.0, Culture=neutral, PublicKeyToken=null
2022-06-08 14:38:10 [verbose]: 
2022-06-08 14:38:10 [verbose]: This error has been automatically reported to the devs.
2022-06-08 14:38:10 [verbose]: ⚠️ Failed to add ruleset osu.Game.Rulesets.Karaoke.Resources, Version=2022.608.1.0, Culture=neutral, PublicKeyToken=null
2022-06-08 14:38:10 [verbose]: 
2022-06-08 14:38:10 [verbose]: This error has been automatically reported to the devs.
2022-06-08 14:38:10 [verbose]: ⚠️ Click to resume first-run setup at any point
2022-06-08 14:38:11 [debug]: Focus changed from nothing to NotificationOverlay.
2022-06-08 14:38:12 [debug]: MouseDownEvent(Left) handled by NotificationOverlay.
2022-06-08 14:38:12 [debug]: ClickEvent(Left) handled by SimpleErrorNotification.
2022-06-08 14:38:12 [debug]: MouseClick handled by SimpleErrorNotification.
2022-06-08 14:38:15 [debug]: MouseDownEvent(Left) handled by NotificationOverlay.
2022-06-08 14:38:15 [debug]: Focus changed from NotificationOverlay to nothing.
2022-06-08 14:38:15 [debug]: MouseDownEvent(Left) handled by OsuLogo.
2022-06-08 14:38:15 [verbose]: ButtonSystem's state changed from Initial to TopLevel
2022-06-08 14:38:15 [debug]: ClickEvent(Left) handled by OsuLogo.
2022-06-08 14:38:15 [debug]: MouseClick handled by OsuLogo.
2022-06-08 14:38:16 [debug]: Focus changed from nothing to LoginForm.
2022-06-08 14:38:16 [debug]: Focus changed from LoginForm to LoginPanel.
2022-06-08 14:38:16 [debug]: Focus changed from LoginPanel to LoginForm.
2022-06-08 14:38:16 [debug]: Focus changed from LoginForm to OsuTextBox.
2022-06-08 14:38:16 [debug]: MouseDownEvent(Left) handled by LoginOverlay.
2022-06-08 14:38:16 [debug]: Focus changed from OsuTextBox to nothing.
2022-06-08 14:38:16 [debug]: ClickEvent(Left) handled by MainMenuButton.
2022-06-08 14:38:16 [debug]: MouseClick handled by MainMenuButton.
2022-06-08 14:38:16 [debug]: Focus changed from nothing to SeekLimitedSearchTextBox.
2022-06-08 14:38:20 [debug]: MouseDownEvent(Left) handled by SettingsOverlay.
2022-06-08 14:38:20 [debug]: ClickEvent(Left) handled by SettingsButton.
2022-06-08 14:38:20 [debug]: MouseClick handled by SettingsButton.
andy840119 commented 2 years ago

And notice that it will only caused in the local. Because it will be packed into single dll in the release build.

andy840119 commented 2 years ago

Not a big deal, just annoying.

andy840119 commented 2 years ago

Not really sure will it be a good idea to place something like FakeRuleset in this repo? Anyway, the FakeRuleset will not be found in the release build, i guess?

See RulesetStore in the osu.game

try
{
    LoadedAssemblies[assembly] = assembly.GetTypes().First(t => t.IsPublic && t.IsSubclassOf(typeof(Ruleset)));
}
catch (Exception e)
{
    Logger.Error(e, $"Failed to add ruleset {assembly}");
}