Since a couple of weeks I suddenly have issues with the SpecFlow extension in Visual Studio 2019 (professional edition). Out of the blue it stopped working. First I thought because of an update of VS, but other colleagues of mine are using the same (latest) version of VS and for them SpecFlow works.
The problems I'm experiencing are:
- No settings menu for SpecFlow (Tools - Options - SpecFlow)
- A NullReferenceException when opening a feature file (see end of post for entry of activity log)
- When feature file is opened no syntax highlighting
- No context menu
The test explorer is still discovering the tests and I can still run them, but not from the feature file (neither debugging the steps).
The extension is installed and enabled correctly (as far as I can tell). Already tried the following without success:
- Uninstall and install the SpecFlow for Visual Studio 2019 extension
- Uninstall SpecFlow and install Deveroom
- Uninstall Visual Studio 2019 and install again
Any of you have any idea on what might be causing this?
Activity log entry
<entry> <record>806</record> <time>2021/02/09 09:25:56.786</time> <type>Error</type> <source>Editor or Editor Extension</source> <description>System.NullReferenceException: Object reference not set to an instance of an object.
 at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.<.ctor>b__9_0() in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\ProjectScopeFactory.cs:line 52
 at TechTalk.SpecFlow.VsIntegration.Implementation.Utils.SynchInitializedInstance`1.EnsureInitialized()
 at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.<.ctor>b__9_2(Project project) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\ProjectScopeFactory.cs:line 64
 at TechTalk.SpecFlow.VsIntegration.Implementation.Utils.SynchronizedResultCache`3.GetOrCreate(TSource source)
 at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.GetProjectScope(Project project) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\ProjectScopeFactory.cs:line 76
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.CreateLanguageService(ITextBuffer textBuffer) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinLanguageServiceFactory.cs:line 51
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.<>c__DisplayClass7_0.<GetLanguageService>b__0() in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinLanguageServiceFactory.cs:line 43
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.<>c__DisplayClass3_0`1.<GetOrCreate>b__0() in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinBufferServiceManager.cs:line 32
 at Microsoft.VisualStudio.Utilities.PropertyCollection.GetOrCreateSingletonProperty[T](Object key, Func`1 creator)
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.GetOrCreate[TService](ITextBuffer textBuffer, Func`1 creator) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinBufferServiceManager.cs:line 29
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.GetLanguageService(ITextBuffer textBuffer) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinLanguageServiceFactory.cs:line 43
 at TechTalk.SpecFlow.VsIntegration.GherkinFileEditor.GherkinFileClassifierProvider.<>c__DisplayClass3_0.<GetClassifier>b__0() in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\GherkinFileEditor\GherkinFileClassifierProvider.cs:line 31
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.<>c__DisplayClass3_0`1.<GetOrCreate>b__0() in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinBufferServiceManager.cs:line 32
 at Microsoft.VisualStudio.Utilities.PropertyCollection.GetOrCreateSingletonProperty[T](Object key, Func`1 creator)
 at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.GetOrCreate[TService](ITextBuffer textBuffer, Func`1 creator) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\LanguageService\GherkinBufferServiceManager.cs:line 29
 at TechTalk.SpecFlow.VsIntegration.GherkinFileEditor.GherkinFileClassifierProvider.GetClassifier(ITextBuffer buffer) in D:\a\1\s\TechTalk.SpecFlow.VSIXShared\GherkinFileEditor\GherkinFileClassifierProvider.cs:line 30
 at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierTaggerProvider.<>c__DisplayClass12_0`1.<CreateTagger>b__0(IClassifierProvider provider)
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeEligibleFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, IContentTypeRegistryService contentTypeRegistryService, Object errorSource)
--- End of stack trace from previous location where exception was thrown ---
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) </description> </entry> Edited: After running a repair of VS I could see the menu option for the 'Clear MEF Component Cache' extension. Unfortunately using this got me no further with the SpecFlow extension (still the same issues).

C:/Users/%USERNAME%/AppData/*/Microsoft/Visual Studio/{Version}/ComponentModelCache/would do the trick as well.