Lacro59 / playnite-gameactivity-plugin

This plugin creates datas for your game activities and shows many statistics.
https://playnite.link
MIT License
58 stars 10 forks source link

Error: Object reference not set to an instance of an object and not recording game data #196

Closed itsFaizan49 closed 7 months ago

itsFaizan49 commented 1 year ago

Hello I've been getting this error for quite a while now. So I thought I should finally open an issue. playnite.00000.log playnite.log extensions.log extensions.00000.log

The Error comes everytime i open games. most of the games are locally installed and one steam game.

I tried disabling SuccessStory but still didn't fix the issue. Maybe it's something on your end in the plugin. You should patch this as soon as possible.

I didn't get this error before but after Some playnite updates it's broken.

Kinc4id commented 9 months ago

Same here. I got this error a week or two ago and I get it with every game.

crackalackintv commented 8 months ago

I do get

07-01 04:30:59.617|ERROR|GameActivity#Common:Error on getActivityByListGame()|D:\GitHub\Lacro59\playnite-gameactivity-plugin\source\Views\GameActivityView.xaml.cs|887
System.NullReferenceException: Object reference not set to an instance of an object.
   at CommonPluginsShared.LocalSystem..ctor(String ConfigurationsPath, Boolean WithDiskInfos) in D:\GitHub\Lacro59\playnite-gameactivity-plugin\source\playnite-plugincommon\CommonPluginsShared\LocalSystem.cs:line 47
   at GameActivity.Services.ActivityDatabase.get_LocalSystem() in D:\GitHub\Lacro59\playnite-gameactivity-plugin\source\Services\ActivityDatabase.cs:line 24
   at GameActivity.Models.Activity.get_Configuration() in D:\GitHub\Lacro59\playnite-gameactivity-plugin\source\Models\Activity.cs:line 47
   at GameActivity.Views.GameActivityView.getActivityByListGame() in D:\GitHub\Lacro59\playnite-gameactivity-plugin\source\Views\GameActivityView.xaml.cs:line 887

Since January 4th 2024.

crackalackintv commented 8 months ago

I fixed the issue for me. For some reason the Configurations.json got corrupted and just had @nulls or something in it. I deleted it and the plugin started to work again without issues.

The aforementioned file is in <PlayNite Install Folder>\ExtensionsData\afbb1a0(...)\. There should be a GameActivity folder in there, a config.json and a Configurations.json. For the the latter was corrupted and just garbage instead of JSON, so I deleted the file and restarted Playnite. That fixed the UI and the activity recording issues.

The code in CommonPluginsShared LocalSystem initializer is not very robust and just lets the code run with a Configurations object being null if the serialization fails. It needs to all be inside the try/catch and fail the initialization of the object or default to an empty Configurations object. I assume this is part of the Playnite core code and not the plugin's own code (I haven't developed a plugin yet, just dipped my toes in debugging it to find this error).

Lacro59 commented 7 months ago

https://github.com/Lacro59/playnite-plugincommon/commit/8c664a180e0c5ed9b3eda82b1b9c56f26a6201b2