Add LoginFix, fixes the Canva sign-in crash under Wine - #57
Open
Gamedirection wants to merge 1 commit into
Open
Conversation
WineFix's own README already lists "Canva sign-in dialog patched out (temporary, pending protocol handler fix)" as a known workaround. LoginFix is that fix. It lets sign-in complete instead of disabling it. Root cause: Serif.Affinity.Application.ProcessCommandLineArguments references a WinRT type Wine does not implement (SharedStorageAccessManager), only reached on an unrelated affinity-open-file: argument. The .NET CLR resolves every type in a method body at JIT time, so any call into that method throws TypeLoadException, including the affinity:// OAuth callback path the sign-in flow depends on. Harmony cannot patch ProcessCommandLineArguments directly either. Patching a method, even with a plain prefix, requires Harmony to decompile its IL, which means resolving every operand in the body, including the poisoned call. LoginFix instead patches the method's two callers, ProcessArguments() and SingleInstanceThread(). Both only reference the poisoned type by signature, which Harmony can resolve safely. Both are fully replaced with a safe reimplementation that never calls the real ProcessCommandLineArguments. Built and verified on a manual Wine install and on Lutris, tested on stock distro Wine 11.15. No custom Wine build needed. Adds LoginFix as a sibling plugin project, following WineFix's exact structure (csproj, sln registration, README, LICENSE with the same GPLv2 + Canva Zero-Clause BSD exemption, and a docs page). Verified the full solution still builds cleanly with LoginFix added.
Gamedirection
force-pushed
the
add-loginfix-plugin
branch
from
August 22, 2026 22:52
1b7a928 to
96bd44e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds LoginFix, a plugin that fixes the Canva sign-in flow crashing under Wine. WineFix's own README already lists this as a known limitation:
LoginFix is that fix. It lets sign-in complete instead of disabling it.
Root cause
Serif.Affinity.Application.ProcessCommandLineArgumentsreferences a WinRT type Wine does not implement (SharedStorageAccessManager), only reached on an unrelatedaffinity-open-file:argument. The .NET CLR resolves every type in a method body at JIT time. So any call into that method throwsTypeLoadException, including theaffinity://OAuth callback path the sign-in flow depends on.Harmony cannot patch
ProcessCommandLineArgumentsdirectly either. Patching a method, even with a plain prefix, requires Harmony to decompile its IL. That means resolving every operand in the body, including the poisoned call.The fix
LoginFix patches the method's two callers instead:
ProcessArguments(), the app's own startup command lineSingleInstanceThread(), the named-pipe listener that receives the sign-in callback from a second launched instanceBoth only reference the poisoned type by signature, which Harmony can resolve safely. Both are fully replaced with a safe reimplementation that never calls the real
ProcessCommandLineArguments. The only thing dropped is the unrelatedaffinity-open-file:handling, which needsSharedStorageAccessManagerand cannot work under Wine regardless.Structure
Follows WineFix's exact pattern:
LoginFix/LoginFix.csproj,LoginFixPlugin.cs,Patches/ProcessCommandLineArgumentsPatch.csLoginFix/README.md,LoginFix/LICENSE(GPLv2, with the same Canva Zero-Clause BSD exemption WineFix uses)AffinityPluginLoader.slndocs/loginfix/index.md, linked fromdocs/index.mdandmkdocs.ymlCompatibility with WineFix
LoginFix and WineFix patch different methods and can run together. If both are installed, WineFix's sign-in dialog suppression and LoginFix's working sign-in flow may conflict, since one hides the dialog and the other completes it. Noted in both READMEs. Whether to adjust WineFix's own patch once LoginFix exists is your call, I have not touched WineFix's code in this PR.
Test plan
dotnet build LoginFix/LoginFix.csproj -c Releasesucceeds, 0 warnings, 0 errors.dotnet build -c Releaseon the full solution succeeds, all 4 projects build cleanly.