Pinta icon indicating copy to clipboard operation
Pinta copied to clipboard

Pinta doesn't start after clean install on Windows 10

Open easy-rider-7 opened this issue 5 months ago • 2 comments

Description I've installed Pinta for the first time on my home Windows 10 PC. After instal It doesn't start, I've tries several times. Then I've reinstalled Pinta and have tried again, with the same result.

Additional Info I've started Pinta from command line to log into a file. Pinta.exe > %UserProfile%\output.txt 2>&1

I've got the following log file output:

Unhandled exception: System.InvalidOperationException: Failed to set the specified COM apartment state. Current apartment state 'STA'. at System.Threading.Thread.SetApartmentStateUnchecked(ApartmentState state, Boolean throwOnError) at System.Threading.Thread.SetApartmentState(ApartmentState state) at Gdk.Module.Initialize() at Gsk.Module.Initialize() at Pinta.MainClass.OpenMainWindow(Int32 threads, IEnumerable1 files, Boolean debug) in D:\a\Pinta\Pinta\Pinta\Main.cs:line 84 at Pinta.MainClass.<>c.<Main>b__0_1(Int32 threads, String[] files, Boolean debug) in D:\a\Pinta\Pinta\Pinta\Main.cs:line 74 at System.CommandLine.Handler.<>c__DisplayClass4_03.<SetHandler>b__0(InvocationContext context) at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Version 3.0.2 from 06. July 2025

easy-rider-7 avatar Jul 19 '25 09:07 easy-rider-7

This sounds a bit like some windows behavior change, because gdk explicitly wants to run in STA mode and we try to set it always if on windows.

On your system it looks like you are already starting in STA Mode which would be unexpected.

So perhaps we should add a check via GetAppartmentState before changing the state.

@cameronwhite what do you think? This would require a new release of GirCore.

Edit: or could it be that there is some async code in place so that the code path is executed twice?

badcel avatar Jul 19 '25 10:07 badcel

For Pinta we do have the [STAThread] attribute set for the main thread (https://github.com/PintaProject/Pinta/blob/986075074787ea8fdba4dafae9fa3f9c5736e12d/Pinta/Main.cs#L38) so the Failed to set the specified COM apartment state. Current apartment state 'STA' error message makes sense

But I'm just confused why this error message wasn't always showing up, since the docs seem to indicate that this should have always been an error. I tried installing 3.0.2 on my Windows 10 VM and it launches fine, FWIW

cameronwhite avatar Jul 20 '25 18:07 cameronwhite