diff --git a/I18N Commander/UI WinForms/Components/SectionTree.cs b/I18N Commander/UI WinForms/Components/SectionTree.cs index 196facd..02ede17 100644 --- a/I18N Commander/UI WinForms/Components/SectionTree.cs +++ b/I18N Commander/UI WinForms/Components/SectionTree.cs @@ -13,7 +13,9 @@ public partial class SectionTree : UserControl public SectionTree() { this.InitializeComponent(); - if(this.DesignMode) + + // Check if we are in the designer: + if(Program.SERVICE_PROVIDER is null) return; // Get the DI context from the main form: diff --git a/I18N Commander/UI WinForms/Program.cs b/I18N Commander/UI WinForms/Program.cs index 5c21401..a26755f 100644 --- a/I18N Commander/UI WinForms/Program.cs +++ b/I18N Commander/UI WinForms/Program.cs @@ -8,7 +8,7 @@ namespace UI_WinForms; internal static class Program { internal const string VERSION = "v0.1.0"; - internal static IServiceProvider SERVICE_PROVIDER = null!; + internal static IServiceProvider? SERVICE_PROVIDER; [STAThread] private static void Main()