zacharied / FFXIV-Plugin-HudManager

10 stars 6 forks source link

Plugin crashing on latest Dalamud #41

Closed SeanLatimer closed 2 years ago

SeanLatimer commented 2 years ago

The plugin is currently crashing on Fate related code due to changes with FFXIVClientStructs. Seems like it's a breaking change to something plugins shouldn't have been using based on discussion on #plugin-testing

https://github.com/zacharied/FFXIV-Plugin-HudManager/blob/2488d92f55fba62e090984cbbeea42e9241e74b2/HUD%20Manager/Statuses.cs#L155

Error: eyJXaGVuIjoiMjAyMi0wNi0yMVQyMToxNjowOC45ODY0MzgxKzAxOjAwIiwiSW5mbyI6IlN5c3RlbS5NaXNzaW5nTWV0aG9kRXhjZXB0aW9uOiBNZXRob2Qgbm90IGZvdW5kOiAnRkZYSVZDbGllbnRTdHJ1Y3RzLkZGWElWLkNsaWVudC5HYW1lLkZhdGUuRmF0ZU1hbmFnZXIqIEZGWElWQ2xpZW50U3RydWN0cy5GRlhJVi5DbGllbnQuR2FtZS5GYXRlLkZhdGVNYW5hZ2VyLmdldF9wSW5zdGFuY2UoKScuXHJcbiAgIGF0IEhVRF9NYW5hZ2VyLlN0YXR1c2VzLklzSW5GYXRlKENoYXJhY3RlciBwbGF5ZXIpXHJcbiAgIGF0IEhVRF9NYW5hZ2VyLlN0YXR1c0V4dGVuc2lvbnMuQWN0aXZlKFN0YXR1cyBzdGF0dXMsIFBsdWdpbiBwbHVnaW4sIENoYXJhY3RlciBwbGF5ZXIpIGluIEM6XFxVc2Vyc1xcemFjaGRcXENvZGVcXEhVRE1hbmFnZXItRnJlc2gyXFxIVUQgTWFuYWdlclxcU3RhdHVzZXMuY3M6bGluZSAzOTRcclxuICAgYXQgSFVEX01hbmFnZXIuU3RhdHVzZXMuVXBkYXRlKENoYXJhY3RlciBwbGF5ZXIpIGluIEM6XFxVc2Vyc1xcemFjaGRcXENvZGVcXEhVRE1hbmFnZXItRnJlc2gyXFxIVUQgTWFuYWdlclxcU3RhdHVzZXMuY3M6bGluZSA5M1xyXG4gICBhdCBIVURfTWFuYWdlci5Td2FwcGVyLk9uRnJhbWV3b3JrVXBkYXRlKEZyYW1ld29yayBmcmFtZXdvcmspIGluIEM6XFxVc2Vyc1xcemFjaGRcXENvZGVcXEhVRE1hbmFnZXItRnJlc2gyXFxIVUQgTWFuYWdlclxcU3dhcHBlci5jczpsaW5lIDY0XHJcbiAgIGF0IERhbGFtdWQuR2FtZS5GcmFtZXdvcmsuSGFuZGxlRnJhbWV3b3JrVXBkYXRlKEludFB0ciBmcmFtZXdvcmspIGluIEM6XFxnb2F0c29mdFxcY29tcGFueXNlY3JldHNcXGRhbGFtdWRcXEdhbWVcXEZyYW1ld29yay5jczpsaW5lIDMzNiIsIkNvbnRleHQiOiJFeGNlcHRpb24gd2hpbGUgZGlzcGF0Y2hpbmcgRnJhbWV3b3JrOjpVcGRhdGUgZXZlbnQuIn0=

{
  "When": "2022-06-21T21:16:08.9864381+01:00",
  "Info": "System.MissingMethodException: Method not found: 'FFXIVClientStructs.FFXIV.Client.Game.Fate.FateManager* FFXIVClientStructs.FFXIV.Client.Game.Fate.FateManager.get_pInstance()'.\r\n   at HUD_Manager.Statuses.IsInFate(Character player)\r\n   at HUD_Manager.StatusExtensions.Active(Status status, Plugin plugin, Character player) in C:\\Users\\zachd\\Code\\HUDManager-Fresh2\\HUD Manager\\Statuses.cs:line 394\r\n   at HUD_Manager.Statuses.Update(Character player) in C:\\Users\\zachd\\Code\\HUDManager-Fresh2\\HUD Manager\\Statuses.cs:line 93\r\n   at HUD_Manager.Swapper.OnFrameworkUpdate(Framework framework) in C:\\Users\\zachd\\Code\\HUDManager-Fresh2\\HUD Manager\\Swapper.cs:line 64\r\n   at Dalamud.Game.Framework.HandleFrameworkUpdate(IntPtr framework) in C:\\goatsoft\\companysecrets\\dalamud\\Game\\Framework.cs:line 336",
  "Context": "Exception while dispatching Framework::Update event."
}
SeanLatimer commented 2 years ago

Specifically, Resolver.Initialize should only be called if you're shipping your own version of structs with the plugin. So any blocks as below can be removed.

if (!Resolver.Initialized)
    Resolver.Initialize();
SeanLatimer commented 2 years ago

I've submitted a PR that should fix the crashes here: https://github.com/zacharied/FFXIV-Plugin-HudManager/pull/42

zacharied commented 2 years ago

Unfortunately didn't see your PR until I fixed it myself, but I appreciate the submission!

Fixed in 477fa570a99971af0caba5609dffe20d4344f2fd.