I see a number of hits on the net for "0xC0000602 combase".
Some like this one point to bugs within the Windows UI.
https://github.com/microsoft/microsoft-ui-xaml/issues/3954
That entry is from 2021, so I would hope that the fix has made its way to general release by now. On the pc where you are compiling the program, is Visual Studio up to date? Is Windows up to date? On the pc where you are trying to run the program, is Windows up to date? (All updates in Windows Update installed?)
I don't do much programming anymore but one technique that I found useful was to make sure that I had a try/catch in most routines (at least in my main entry point) and to write "here's what I'm doing" entries to a log file. That allows me to understand what sections of my code have been called and if they encountered any errors.
If your program crashes before any log file entries get written, then that would point to a problem with the environment. OS, Dot Net framework, other dll's, etc, etc.
In psuedo-code.
dim trace as string = "" // global variable
sub Main {
try { // have at least 1 try/catch
trace = "Initializing"
Logit "Starting up."
initialize variables
trace = "Calling DoSomething"
call DoSomething
trace = "DoSomething has finished, closing files"
close data files
trace
close DB connections
Logit "Exiting."
return
} catch {
Logit "We crashed in Main."
Logit "I was working on: " & trace
Logit exception.info
}
}
Sub DoSomething {
try { // optional
trace = "Calculating a"
a = b + c
trace = "Done doing something"
} catch {
Logit "We crashed in DoSomething."
Logit "I was working on: " & trace
Logit exception.info
}
}
Sub Logit(msg) {
debug = read flag from registry
if (debug) {Write msg to log file}
}