[MarshalAs(UnmanagedType.LPWStr)]
[UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true, CharSet = CharSet.Auto)]
An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module.
var result = false;
result = CreateProcessW(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes,
bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, out lpProcessInformation); // THROWS HERE
try
{
messageQueue.Enqueue("Text");
}
catch
{
// swallow exceptions so that any issues caused by this code do not crash target process
}
return result;
var result = false;
result = CreateProcessW(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes,
bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, out lpProcessInformation); // DOES NOT THROW AFTER COMMENTING OUT BELOW
try
{
//messageQueue.Enqueue("Text");
}
catch
{
// swallow exceptions so that any issues caused by this code do not crash target process
}
return result;