Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions DXMainClient/DXGUI/GameClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using DTAClient.Online;
using ClientGUI.Settings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Rampastring.XNAUI.XNAControls;
using MainMenu = DTAClient.DXGUI.Generic.MainMenu;
using System.Threading.Tasks;
Expand Down Expand Up @@ -259,9 +258,12 @@ private static Random GetRandom()

private IServiceProvider BuildServiceProvider(WindowManager windowManager)
{
// Create host - this allows for things like DependencyInjection
IHost host = Host.CreateDefaultBuilder()
.ConfigureServices((_, services) =>
// Dependency-injection container. This previously built a full .NET Generic Host
// (Host.CreateDefaultBuilder().Build()), but the client only ever used it as a DI
// container, and that Build() hangs on macOS: the host's configuration provider sets
// up a FileSystemWatcher (reloadOnChange), whose FSEvents-backed setup stalls there.
// A plain ServiceCollection provides the same DI with none of that machinery.
var services = new ServiceCollection();
{

@11EJDE11 11EJDE11 Jul 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

{} Brackets could be removed?

// services (or service-like)
services
Expand Down Expand Up @@ -336,10 +338,8 @@ private IServiceProvider BuildServiceProvider(WindowManager windowManager)
.AddTransientXnaControl<FileSettingCheckBox>()
.AddTransientXnaControl<FileSettingDropDown>();
}
)
.Build();

return host.Services.GetService<IServiceProvider>();
return services.BuildServiceProvider();
}

private void InitializeUISettings()
Expand Down
7 changes: 6 additions & 1 deletion DXMainClient/Domain/Multiplayer/MapLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ public MapLoader() { }

public void Initialize()
{
MapLoadingComplete += (sender, args) => StartMapFileWatcher();
// .NET's FileSystemWatcher (FSEvents-backed) stalls during setup on macOS.
// Since MapLoadingComplete is invoked synchronously, that would block the map
// loading task from ever completing and hang the client on the loading screen.
// Skip the live map-file watcher on macOS; maps still load, just no hot-reload.
if (!OperatingSystem.IsMacOS())
MapLoadingComplete += (sender, args) => StartMapFileWatcher();
}

/// <summary>
Expand Down
Loading