Specflow: Specflow plugin failure for Visual Studio 2017

Created on 23 Aug 2017  路  13Comments  路  Source: SpecFlowOSS/SpecFlow

Hello,
Just downloaded the specflow for visual studio 2017 to install in VS 2017 professional (15.3.1)
When I try to load the spec flow project it gives an error which asks me to look at the activitylog.xml file

The activitylog.xml file had the following error


785

Error
Editor or Editor Extension
System.NullReferenceException: Object reference not set to an instance of an object. at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.<.ctor>b__9_0() at TechTalk.SpecFlow.VsIntegration.Utils.SynchInitializedInstance1.EnsureInitialized()&#x000D;&#x000A; at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.&lt;.ctor&gt;b__9_2(Project project)&#x000D;&#x000A; at TechTalk.SpecFlow.VsIntegration.Utils.SynchronizedResultCache3.GetOrCreate(TSource source) at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.GetProjectScope(Project project) at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.CreateLanguageService(ITextBuffer textBuffer) at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.<>c__DisplayClass7_0.<GetLanguageService>b__0() at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.<>c__DisplayClass1_01.&lt;GetOrCreate&gt;b__0()&#x000D;&#x000A; at Microsoft.VisualStudio.Utilities.PropertyCollection.GetOrCreateSingletonProperty[T](Object key, Func1 creator) at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.GetOrCreateTService --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Any idea why this is happening and what should I do to fix this? This results in feature file not generating the corresponding steps. Neither the context menu works in the feature file; rendering the entire IDE useless for specflow tests.

Thanks

VisualStudioIntegration

Most helpful comment

I am having issue with VS2017 Specflow code behind generation.

#error Generation error: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

All 13 comments

Launching the IDE as an administrator gets rid of this issue; however the context menu still doesn't render the much needed items.

What kind of project is your testing project?
Is it still a .NET Framework project in the old format or already in the new csproj?

Do you get in also in the example projects?
They are here: https://github.com/techtalk/SpecFlow.Plus.Examples

Thanks for the message. I am just trying to create a class library with some feature files which will be consumed by my MS Tests.
To do this, I installed the Spec Flow Plugin for Visual Studio 2017. The installation went fine without any issues.

I created a new class library in .net framework 4.5.2 and from the template I tried to add a new specflow feature file. This is the first point of encountering that error.

I closed my IDE and restarted it. Opening this project / solution threw the same error.

My context menu just has the below options

image

Uninstalling the plugin gets rid of the issue; but can't do much with these options.

Ran into same issue on reinstalling this version of Specflow Integration for Visual 2017. For me it happened when I opened a feature file. VS2017 version 15.3.1 Stack trace shown in Activity.xml was:
System.NullReferenceException: Object reference not set to an instance of an object. at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.<.ctor>b__9_0() at TechTalk.SpecFlow.VsIntegration.Utils.SynchInitializedInstance1.EnsureInitialized() at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.<.ctor>b__9_2(Project project) at TechTalk.SpecFlow.VsIntegration.Utils.SynchronizedResultCache3.GetOrCreate(TSource source) at TechTalk.SpecFlow.VsIntegration.LanguageService.ProjectScopeFactory.GetProjectScope(Project project) at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.CreateLanguageService(ITextBuffer textBuffer) at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinLanguageServiceFactory.<>c__DisplayClass7_0.b__0() at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.<>c__DisplayClass1_01.<GetOrCreate>b__0() at Microsoft.VisualStudio.Utilities.PropertyCollection.GetOrCreateSingletonProperty[T](Object key, Func1 creator) at TechTalk.SpecFlow.VsIntegration.LanguageService.GherkinBufferServiceManager.GetOrCreateTService --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Hi,

I am getting the same error. I have Visual Studio Version 15.3.3 and SpecFlow Version 2017.1.6.

Our test project (.NET 4.5.2) with SpecFlow has been used for a number of years without any problems. We have many feature files which are updated from time to time. The problem started occuring right after I reinstalled the Visual Studio (to the same version as before and where SpecFlow was ok) and installed the SpecFlow extension. It has not worked since.

It has been some time since last entry, is this issue getting a solution soon?

@psoszynski Sorry, but I am not aware that anybody is working on a fix.
Without a project to reproduce the error, we (as in SpecFlow team) has not a really chance to fix this fast.

Could you try to debug it yourself?
The sources are here: https://github.com/techtalk/SpecFlow.VisualStudio

  • open the SpecFlow.VisualStudio.2017.sln
  • starting will launch a experiment instance of VS2017
  • open your solution and try to reproduce the issue
  • fix it ;-)
  • send a PR with the fix ;-)

Thanks, but when I am in the experimental instance og VS2017 so this error deos not happen and SpecFlow works just as expected with all the colorings and bindings. But when I start again in the normal version of VS2017 then SpecFlow is not working and I get the error message as above. Unfortunatelly, I do not have time right now to investigate it more.

This is now working in Visual Studio 2017 build 15.3.5. The issue can be closed.

I am having issue with VS2017 Specflow code behind generation.

#error Generation error: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

Received the same issue today with:

  • SpecFlow 2017.1.12
  • Visual Studio 15.5.7

A workaround that was mentioned on this issue that also seems to work for me was to start Visual Studio via the "Run as Administrator" option.
I'm not blocked in my work but wanted to leave that information if anyone wants to dive deeper. (sorry for my laziness)

same here, I open a specific ticket for this here https://github.com/techtalk/SpecFlow/issues/1054

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings