diff --git a/zzre/Program.RenderDoc.cs b/zzre/Program.RenderDoc.cs index 5554a197..b4edd2f6 100644 --- a/zzre/Program.RenderDoc.cs +++ b/zzre/Program.RenderDoc.cs @@ -56,7 +56,7 @@ private static void SetupRenderDocKeys(SdlWindow window) } #else private static void AddGlobalRenderDocOption(RootCommand _) { } - private static void LoadRenderDoc(InvocationContext _) { } + private static void LoadRenderDoc(ITagContainer _) { } private static void SetupRenderDocKeys(SdlWindow _) { } #endif } diff --git a/zzre/tools/OpenDocumentSet.cs b/zzre/tools/OpenDocumentSet.cs index 0e194898..901dba20 100644 --- a/zzre/tools/OpenDocumentSet.cs +++ b/zzre/tools/OpenDocumentSet.cs @@ -37,10 +37,14 @@ public bool TryGetEditorFor(IResource resource, [NotNullWhen(true)] out IDocumen return openEditor != null; } - public TEditor OpenWith(string pathText) where TEditor : IDocumentEditor => + public TEditor OpenWith< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEditor + >(string pathText) where TEditor : IDocumentEditor => OpenWith(new FilePath(pathText)); - public TEditor OpenWith(FilePath path) where TEditor : IDocumentEditor + public TEditor OpenWith< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEditor + >(FilePath path) where TEditor : IDocumentEditor { var resourcePool = diContainer.GetTag(); var resource = resourcePool.FindFile(path.ToPOSIXString()); @@ -49,7 +53,9 @@ public TEditor OpenWith(FilePath path) where TEditor : IDocumentEditor return OpenWith(resource); } - public TEditor OpenWith(IResource resource) where TEditor : IDocumentEditor + public TEditor OpenWith< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEditor + >(IResource resource) where TEditor : IDocumentEditor { if (TryGetEditorFor(resource, out var prevEditor)) { @@ -62,7 +68,9 @@ public TEditor OpenWith(IResource resource) where TEditor : IDocumentEd return newEditor; } - public void AddEditorType(string extension) where TEditor : IDocumentEditor + public void AddEditorType< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEditor + >(string extension) where TEditor : IDocumentEditor { editorTypes.Add(extension.ToLowerInvariant(), typeof(TEditor)); _ = GetConstructorFor(); @@ -94,7 +102,10 @@ public IDocumentEditor Open(IResource resource) } private static readonly Dictionary> knownConstructors = new(); - private static Func GetConstructorFor() where TEditor : IDocumentEditor + + private static Func GetConstructorFor< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEditor>() + where TEditor : IDocumentEditor { var type = typeof(TEditor); if (knownConstructors.TryGetValue(type, out var prevCtor))