Skip to content

Build WinForms Quickstart for .NET 4.8 Windows 11#251

Open
Aaron LaBeau (biozal) wants to merge 9 commits intomainfrom
da-144-winforms-dotnet-48
Open

Build WinForms Quickstart for .NET 4.8 Windows 11#251
Aaron LaBeau (biozal) wants to merge 9 commits intomainfrom
da-144-winforms-dotnet-48

Conversation

@biozal
Copy link
Copy Markdown
Contributor

This PR provides a Quickstart for Windows 11 and .NET version 4.8. This version targets a pre-release version of the Ditto SDK and was requested by Brian Plattenburg (@bplattenburg).

This shares as much code as possible with the modern version of Windows Form Quickstart example. Very important notes:

  • This only compiles on Windows with Visual Studio (tested on Visual Studio 2019/2026). It probably works in Rider but was not tested with it.
  • This requires the following nuget package: 4.14.4-experimental-net-framework-support.1
    • It will not work with any other version than this.
  • It will never build on any other platform than Windows 11 or Windows Server because it requires .NET 4.8 specifically and that is limited to Windows platforms.

No tests are provided for the app currently.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Windows Forms quickstart targeting .NET Framework 4.8 (Windows 11 / VS) using an experimental Ditto SDK build, largely mirroring the existing modern WinForms sample.

Changes:

  • Introduces a new dotnet-winforms-net48/ WinForms app (UI + Ditto CRUD/observe wrapper) targeting net48.
  • Adds net48-specific build assets (solution/project, packages.config, native DLL copy rule).
  • Adds local .env-based configuration loading and quickstart documentation.

Reviewed changes

Copilot reviewed 18 out of 22 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
dotnet-winforms-net48/packages.config Pins Ditto experimental net48-support packages and supporting dependencies.
dotnet-winforms-net48/ToDoTask.cs Task document model for the tasks collection (Newtonsoft.Json attributes).
dotnet-winforms-net48/TasksPeerService.cs Singleton service wrapper around TasksPeer for app-wide access.
dotnet-winforms-net48/TasksPeer.cs Ditto SDK wrapper implementing CRUD + subscription + observation for tasks.
dotnet-winforms-net48/Taskapp.WinForms.Net48.sln New VS solution for the net48 WinForms quickstart.
dotnet-winforms-net48/Taskapp.WinForms.Net48.csproj Net48 WinForms project file with explicit assembly refs and native DLL copy.
dotnet-winforms-net48/README.md Net48-specific prerequisites and run instructions.
dotnet-winforms-net48/Properties/Settings.settings Default settings file for WinForms project scaffolding.
dotnet-winforms-net48/Properties/Settings.Designer.cs Auto-generated Settings designer.
dotnet-winforms-net48/Properties/Resources.resx Project resources container.
dotnet-winforms-net48/Properties/Resources.Designer.cs Auto-generated Resources designer.
dotnet-winforms-net48/Properties/AssemblyInfo.cs Assembly metadata for net48 build.
dotnet-winforms-net48/Program.cs WinForms entry point with async initialization via a loading dialog.
dotnet-winforms-net48/MainForm.resx Resources for the main WinForms UI.
dotnet-winforms-net48/MainForm.cs Main UI logic: list rendering + add/edit/delete + done toggling.
dotnet-winforms-net48/MainForm.Designer.cs Main form designer-generated layout.
dotnet-winforms-net48/LoadingForm.cs Modal loading form that awaits Ditto initialization.
dotnet-winforms-net48/LoadingForm.Designer.cs Loading form designer-generated layout.
dotnet-winforms-net48/InputDialog.cs Simple modal input dialog for editing task titles.
dotnet-winforms-net48/AppConfiguration.cs .env loader and required config validation.
dotnet-winforms-net48/App.config Declares .NET Framework 4.8 runtime.
dotnet-winforms-net48/.env.sample Sample environment file template for required Ditto settings.
Files not reviewed (4)
  • dotnet-winforms-net48/LoadingForm.Designer.cs: Language not supported
  • dotnet-winforms-net48/MainForm.Designer.cs: Language not supported
  • dotnet-winforms-net48/Properties/Resources.Designer.cs: Language not supported
  • dotnet-winforms-net48/Properties/Settings.Designer.cs: Language not supported

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

Aaron LaBeau (biozal) and others added 8 commits March 20, 2026 13:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Files not reviewed (4)
  • dotnet-winforms-net48/LoadingForm.Designer.cs: Language not supported
  • dotnet-winforms-net48/MainForm.Designer.cs: Language not supported
  • dotnet-winforms-net48/Properties/Resources.Designer.cs: Language not supported
  • dotnet-winforms-net48/Properties/Settings.Designer.cs: Language not supported

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

- Microsoft Windows 11, this uses .NET 4.8 for Windows only
- Visual Studio 2019 or higher (tested on Visual Studio 2019/2026)
- x64 version of Windows (does NOT support 32-bit Windows)
- Does not support ARM64 (however can run on Windows on Windows with x64 emulation if supported by OS/hardware). ARM64 is not officially supported by Ditto for use with the .NET 4.8 framework.
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Typo/duplication: "can run on Windows on Windows" reads like an accidental repeat and is hard to parse. Consider rephrasing to a single "Windows" and clarifying the emulation requirement.

Suggested change
- Does not support ARM64 (however can run on Windows on Windows with x64 emulation if supported by OS/hardware). ARM64 is not officially supported by Ditto for use with the .NET 4.8 framework.
- Does not support ARM64 (however, it can run on Windows on ARM using x64 emulation if supported by the OS/hardware). ARM64 is not officially supported by Ditto for use with the .NET 4.8 framework.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +66
var peer = new TasksPeer(appId, playgroundToken, authUrl, websocketUrl);
peer.Authenticate();
peer.RegisterSubscription();
await peer.InsertInitialTasks();
peer.StartSync();

return peer;
}

private void Authenticate()
{
_ditto.Auth.ExpirationHandler = async (ditto, secondsRemaining) =>
{
// Authenticate when token is expiring
try
{
await ditto.Auth.LoginAsync(
// Your development token, replace with your actual token
PlaygroundToken,
// Use DittoAuthenticationProvider.Development for playground, or your actual provider
DittoAuthenticationProvider.Development
);
Console.WriteLine("Authentication successful");
}
catch (Exception error)
{
Console.WriteLine($"Authentication failed: {error}");
}
};
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Authenticate() only sets ExpirationHandler but never performs an initial login. As a result, the peer may start sync and register subscriptions without ever authenticating (the expiration handler may not run until after a successful login). Consider calling LoginAsync during Create (and keeping ExpirationHandler for refresh) so initialization deterministically authenticates before RegisterSubscription() / StartSync().

Copilot uses AI. Check for mistakes.
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.

3 participants