Skip to content

Hide console window for launch/ui verbs (fixes #131)#205

Open
CodyBatt wants to merge 1 commit into
masterfrom
fix/131-silent-rdp-launch
Open

Hide console window for launch/ui verbs (fixes #131)#205
CodyBatt wants to merge 1 commit into
masterfrom
fix/131-silent-rdp-launch

Conversation

@CodyBatt

Copy link
Copy Markdown
Contributor
  • Upgrade from .NET 6 to .NET 8
  • Call FreeConsole() on Windows for 'launch' and 'ui' verbs to detach from the console, causing the OS to destroy the console window when SCALUS is invoked as a protocol handler from a browser
  • Add --debug flag to launch/ui verbs to keep console visible for troubleshooting
  • CLI commands (info, register, --help, etc.) remain unaffected
  • Update RuntimeIdentifiers from win10-x64 to win-x64 for .NET 8
  • Bump package versions (Newtonsoft.Json, ASP.NET Core MVC, System.Security.Cryptography.ProtectedData)

This approach using FreeConsole to detach results in a slight flicker of a console window. An alternative would be to switch the executable to WinExe, but that has other side effects when trying to run scalus commands within the console. Overall I think FreeConsole works better at the cost of a flicker.

Fixes #131

- Upgrade from .NET 6 to .NET 8
- Call FreeConsole() on Windows for 'launch' and 'ui' verbs to detach
  from the console, causing the OS to destroy the console window when
  SCALUS is invoked as a protocol handler from a browser
- Add --debug flag to launch/ui verbs to keep console visible for
  troubleshooting
- CLI commands (info, register, --help, etc.) remain unaffected
- Update RuntimeIdentifiers from win10-x64 to win-x64 for .NET 8
- Bump package versions (Newtonsoft.Json, ASP.NET Core MVC,
  System.Security.Cryptography.ProtectedData)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades SCALUS to .NET 8 and aims to prevent a console window from appearing when SCALUS is invoked as a protocol handler (notably for the launch and default ui verbs), while adding a --debug flag to keep the console visible for troubleshooting.

Changes:

  • Upgrade projects from net6.0 to net8.0 and update Windows RID from win10-x64 to win-x64.
  • Detach from the Windows console for launch/ui invocations via FreeConsole(), with --debug to opt out.
  • Bump select package versions (e.g., Newtonsoft.Json, ASP.NET Core MVC NewtonsoftJson, ProtectedData).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/OneIdentity.Scalus.Test.csproj Upgrade test project to .NET 8, update RID and Newtonsoft.Json.
src/Ui/Options.cs Add --debug flag to the ui verb.
src/Program.cs Implement console detaching behavior and --debug detection logic.
src/OneIdentity.Scalus.csproj Upgrade main project to .NET 8, update RID, warning suppressions, and package versions.
src/Launch/Options.cs Add --debug flag to the launch verb.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Program.cs
Comment on lines +50 to +53
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && ShouldHideConsole(args))
{
FreeConsole();
}
Comment thread src/Program.cs
Comment on lines +141 to +148
// --debug flag keeps the console visible for troubleshooting
if (args.Any(a => string.Equals(a, "--debug", StringComparison.OrdinalIgnoreCase)))
{
return false;
}

return string.Equals(args[0], "launch", StringComparison.OrdinalIgnoreCase) ||
string.Equals(args[0], "ui", StringComparison.OrdinalIgnoreCase);
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

Successfully merging this pull request may close these issues.

Start RDP sessions silently

2 participants