NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
126 stars 24 forks source link

ERROR: Class NTConfig does not implement IEditorConfig interface, using default configuration instead #39

Closed gregveres closed 3 years ago

gregveres commented 3 years ago

I don't know when this started happening. It could have been back in early august - I haven't done much since then.

I have an NTCconfig.cs file in my project beside my .nt files. I have Version 0.1.11 of the extension installed The project with the NTConfig.cs file references the NuGet package NTypewriter.Editor.Config version 0.1.10-alpha. That seems to be the latest version.

My NTConfig.cs file is:

using System.Collections.Generic;
using NTypewriter.Editor.Config;

namespace SkyCourt.UI.ui.src.api
{
    [NTEditorFile]
    public class NTConfig : EditorConfig
    {
        public override bool AddGeneratedFilesToVSProject { get => false; }
        public override IEnumerable<string> ProjectsToBeSearched
        {
            get
            {
                yield return "SkyCourt";
                yield return "SkyCourt.App.Api";
                yield return "SkyCourt.App.Models";
                yield return "SkyCourt.App.Utilities";
                yield return "SkyCourt.App.ViewModels";
            }
        }
    }
}

Any thoughts? Is there suppposed to be a verson 1.11 of the NuGet package?

NeVeSpl commented 3 years ago

They were not any changes since May.
Nugets referenced from the project does not matter, they are only for syntax completion, NT Editor is shipped with the latest version of them.

This message may appear when two versions of NTypewriter.Editor.Config dlls are loaded into VS app domain, which is very hard to achive in normal context. I would check if NT Editor is instaled only once, and reinstal it.

gregveres commented 3 years ago

Thanks for the suggestion of looking for two versions of NTypewriter.Editor.config being loaded. I was only including the NuGet package in one project, so that wasn't it. But it got me thinking that VS had been running for quite a while (over a week). I figured it was time to restart VS and that fixed it.

NeVeSpl commented 3 years ago

It is not exactly what I meant :D. You can have as many projects with references to NTypewriter.Editor.Config nuget as you want. They do not matter at all, and they are not loaded into VS app domain. To VS app domain are loaded only dlls that are part of NT Editor/addin. And apparently after long use of VS, somehow VS loaded NT Editor more than once into VS app domain/memory.