Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[.net8] SignatureHelper can not initialize unmanaged function pointers #1539

Closed
Ottermandias opened this issue Nov 21, 2023 · 3 comments
Closed

Comments

@Ottermandias
Copy link
Contributor

Ottermandias commented Nov 21, 2023

It seems like the SignatureHelper / GameInteropProvider is unable to infer the usage type of signatures provided for unmanaged delegates, for example in QoLBar, the initialization step at https://github.com/UnknownX7/QoLBar/blob/09a16b04420b9c7b110bea23edbd24d5b7535ad0/Game.cs#L130C31-L130C31
fails for this unmanaged function
https://github.com/UnknownX7/QoLBar/blob/09a16b04420b9c7b110bea23edbd24d5b7535ad0/Game.cs#L61

with

10:41:43.075 ERR | [QoLBar] Failed loading QoLBar!
10:41:43.075 ERR | Dalamud.Utility.Signatures.SignatureException: Invalid Signature attribute for QoLBar.Game.getHUDLayout: could not detect desired signature use, set SignatureUseFlags manually
10:41:43.075 ERR |    at Dalamud.Utility.Signatures.SignatureHelper.<>c__DisplayClass1_0.<Initialize>g__Invalid|4(String message, Boolean prepend, <>c__DisplayClass1_1&, <>c__DisplayClass1_2&) in C:\goatsoft\companysecrets\dalamud\Utility\Signatures\SignatureHelper.cs:line 73
10:41:43.075 ERR |    at Dalamud.Utility.Signatures.SignatureHelper.Initialize(Object self, Boolean log) in C:\goatsoft\companysecrets\dalamud\Utility\Signatures\SignatureHelper.cs:line 184
10:41:43.075 ERR |    at Dalamud.Hooking.Internal.GameInteropProviderPluginScoped.InitializeFromAttributes(Object self) in C:\goatsoft\companysecrets\dalamud\Hooking\Internal\GameInteropProviderPluginScoped.cs:line 45
10:41:43.075 ERR |    at QoLBar.Game.Initialize() in /work/repo/Game.cs:line 130
10:41:43.075 ERR |    at QoLBar.QoLBar.ReadyPlugin() in /work/repo/QoLBar.cs:line 72
@aers
Copy link
Contributor

aers commented Nov 21, 2023

https://learn.microsoft.com/en-us/dotnet/core/compatibility/reflection/8.0/function-pointer-reflection

I think just adding Type.IsFunctionPointer to the or check for pointer type should just work here.

@Ottermandias
Copy link
Contributor Author

Yeah, I quickly tested it before PR'ing and it loads QoLBar again no issue - I don't know if it might cause any other issues with misidentification, but I wouldn't think so.

@KazWolfe
Copy link
Member

KazWolfe commented Jan 8, 2024

Closing as merged.

@KazWolfe KazWolfe closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants