fix: Use explicit Lazy initializer

Previously DXamlCore and CoreServices used Lazy without explicit initializer parameter. While this worked for debug build, linker removed the "unused" parameterless constructors for these types and reflection then could not find and use them. Using the explicit initializer ensures the constructor is explicitly used and is not linked away.
This commit is contained in:
Martin Zikmund 2021-07-07 15:40:32 +02:00
Родитель 3a23e4d08a
Коммит e9d02f3f58
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -14,7 +14,7 @@ namespace DirectUI
{
internal class DXamlCore
{
private static readonly Lazy<DXamlCore> _current = new Lazy<DXamlCore>();
private static readonly Lazy<DXamlCore> _current = new Lazy<DXamlCore>(() => new DXamlCore());
private BuildTreeService? _buildTreeService;
private BudgetManager? _budgetManager;

Просмотреть файл

@ -13,7 +13,7 @@ namespace Uno.UI.Xaml.Core
{
internal class CoreServices
{
private static Lazy<CoreServices> _instance = new Lazy<CoreServices>();
private static Lazy<CoreServices> _instance = new Lazy<CoreServices>(() => new CoreServices());
private VisualTree? _mainVisualTree = null;