SpecFlow.Rider icon indicating copy to clipboard operation
SpecFlow.Rider copied to clipboard

Step definitions stopped being recognized when debugging test

Open pmihalcin opened this issue 3 years ago • 4 comments

I have test project which relies on library of shared step definitions. When I run Rider for the first time and only run features, all is good. Plugin works and I can navigate to step definitions from features. Steps stopped being recognized when I start debugging test. It seems like steps cache gets corrupted or something. I also remember it was working before and then it suddenly started occurring consistently.

Version: 1.13

What can I provide to you to troubleshoot the issue?

pmihalcin avatar May 06 '22 09:05 pmihalcin

Hello,

Do a small repro project could help, also are you on linux or windows ?

Socolin avatar Jul 16 '22 02:07 Socolin

I'm on windows.. that external library of steps is not opensource.. can I somehow provide some Rider debugging information for you to investigate?

pmihalcin avatar Jan 10 '23 12:01 pmihalcin

Look similar to https://github.com/SpecFlowOSS/SpecFlow.Rider/issues/182 can you check if you see an exception in the backend.log ? image

Socolin avatar Nov 27 '23 07:11 Socolin

@Socolin I found this in the latest backend.log when this issue occurred.

08:37:27.278 |E|                               | :1                 | An item with the same key has already been added. Key: Kestrel.SpecFlow.TestHost

--- EXCEPTION #1/2 [ArgumentException]
Message = “An item with the same key has already been added. Key: Kestrel.SpecFlow.TestHost”
ExceptionPath = Root.InnerException
ClassName = System.ArgumentException
Data.ThreadLocalDebugInfo = ReentrancyGuardTaskScheduler::QueueTask
HResult = E_INVALIDARG=COR_E_ARGUMENT=WIN32_ERROR_INVALID_PARAMETER=80070057
Source = System.Private.CoreLib
StackTraceString = “
  at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) in TryInsert.il:line IL_0000 mvid B342
     at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) in Add.il:line IL_000A mvid B342
     at ReSharperPlugin.SpecflowRiderPlugin.Caching.StepsDefinitions.AssemblyStepDefinitions.AssemblyStepDefinitionCache.AddToLocalCache(IPsiAssembly assembly, SpecflowStepsDefinitionsCacheEntries cacheItems) in D:\a\SpecFlow.Rider\SpecFlow.Rider\src\dotnet\ReSharperPlugin.SpecflowRiderPlugin\Caching\StepsDefinitions\AssemblyStepDefinitions\AssemblyStepDefinitionCache.cs:line 139
     at ReSharperPlugin.SpecflowRiderPlugin.Caching.StepsDefinitions.AssemblyStepDefinitions.AssemblyStepDefinitionCache.Merge(IPsiAssembly assembly, Object builtPart, Func`1 checkForTermination) in D:\a\SpecFlow.Rider\SpecFlow.Rider\src\dotnet\ReSharperPlugin.SpecflowRiderPlugin\Caching\StepsDefinitions\AssemblyStepDefinitions\AssemblyStepDefinitionCache.cs:line 120
     at JetBrains.ReSharper.Psi.Caches.Jobs.JobAddAssemblies.Merge(IPsiAssembly assembly, IReadOnlyList`1 builtPart, Func`1 checkForTermination) in Merge.il:line IL_0046 mvid 4C96
”

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “An item with the same key has already been added. Key: Kestrel.SpecFlow.TestHost”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.Util.LoggerBase.Log(LoggingLevel level, String message, Exception ex) in Log.il:line IL_0024 mvid D9B8
     at JetBrains.Diagnostics.LogEx.Error(ILog this, Exception ex, String message) in Error.il:line IL_0000 mvid CC54
     at JetBrains.Util.Logging.Logger.LogException(Exception ex) in LogException.il:line IL_0000 mvid D9B8
     at JetBrains.ReSharper.Psi.Caches.Jobs.JobAddAssemblies.Merge(IPsiAssembly assembly, IReadOnlyList`1 builtPart, Func`1 checkForTermination) in Merge.il:line IL_0020 mvid 4C96
     at JetBrains.ReSharper.Psi.Caches.Jobs.JobAddAssemblies.<>c__DisplayClass11_0.<Do>b__1(KeyValuePair`2 pair) in JobAddAssemblies.il:line IL_0000 mvid 4C96
     at JetBrains.ReSharper.Psi.Caches.Jobs.CacheJobService2.<>c__DisplayClass39_0`1.<ExecuteSplittedWriteActivity>b__3() in CacheJobService2.il:line IL_0000 mvid 4C96 or CacheJobService2.il:line IL_0061 mvid 4C96
     at JetBrains.Util.Logging.Logger.Catch(Action action) in Catch.il:line IL_000F mvid D9B8
     at JetBrains.ReSharper.Psi.Caches.Jobs.CacheJobService2.<>c__DisplayClass39_0`1.<ExecuteSplittedWriteActivity>b__1() in CacheJobService2.il:line IL_0000 mvid 4C96 or CacheJobService2.il:line IL_0061 mvid 4C96
     at JetBrains.Application.Threading.Tasks.TaskHost.AccessViolationCatcher[T](Delegate funcOrAction) in AccessViolationCatcher.il:line IL_001C mvid D9B8
     at JetBrains.Application.Threading.Tasks.TaskHost.ExecuteJetTask[T](Object state) in ExecuteJetTask.il:line IL_0073 mvid D9B8
     at System.Threading.Tasks.Task`1.InnerInvoke() in InnerInvoke.il:line IL_002B mvid B342
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid B342
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in ExecuteWithThreadLocal.il:line IL_0096 mvid B342
     at System.Threading.Tasks.Task.ExecuteEntry() in ExecuteEntry.il:line IL_0036 mvid B342
     at JetBrains.Application.Threading.Tasks.ReentrancyGuardTaskScheduler.<.ctor>b__7_0(Object state) in ReentrancyGuardTaskScheduler.il:line IL_0000 mvid D9B8
     at JetBrains.Application.Threading.Tasks.ReentrancyGuardTaskScheduler.ExecuteWithLock(SendOrPostCallback sendOrPostCallback, Object state, Object currentObject) in ExecuteWithLock.il:line IL_0027 mvid D9B8
     at JetBrains.Util.Concurrency.ExecutionContextEx.<>c__DisplayClass0_0.<Run>b__0(Object _) in ExecutionContextEx.il:line IL_0011 mvid D9B8
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid B342
     at JetBrains.Util.Concurrency.ExecutionContextEx.Run(ExecutionContext context, ContextCallback callback, Object state) in Run.il:line IL_0028 mvid D9B8
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action) in Execute.il:line IL_0145 mvid D9B8
     at JetBrains.Threading.ReentrancyGuard.ExecutePendingActions() in ExecutePendingActions.il:line IL_0053 mvid D9B8
     at JetBrains.Util.Concurrency.ExecutionContextEx.<>c__DisplayClass0_0.<Run>b__0(Object _) in ExecutionContextEx.il:line IL_0011 mvid D9B8
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid B342
     at JetBrains.Util.Concurrency.ExecutionContextEx.Run(ExecutionContext context, ContextCallback callback, Object state) in Run.il:line IL_0028 mvid D9B8
     at JetBrains.Threading.JetDispatcher.Closure.Execute() in Execute.il:line IL_0100 mvid D9B8
     at JetBrains.Threading.JetDispatcher.ProcessQueue(Int32 nMinBucket, Int32 nProcessQueueGeneration) in ProcessQueue.il:line IL_01D0 mvid D9B8
     at JetBrains.Threading.JetDispatcher.<>c__DisplayClass69_0.<ScheduleQueueProcessingOnNativeMarshaller>g__ProcessQueueWithPriority|0() in JetDispatcher.il:line IL_0000 mvid D9B8
     at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore() in InvokeDelegateCore.il:line IL_0000 mvid 1D26
     at System.Windows.Threading.DispatcherOperation.InvokeImpl() in InvokeImpl.il:line IL_0062 mvid 1D26
     at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) in CallbackWrapper.il:line IL_001A mvid 1D26
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid B342
     at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) in Run.il:line IL_0034 mvid 1D26
     at System.Windows.Threading.DispatcherOperation.Invoke() in Invoke.il:line IL_000F mvid 1D26
     at System.Windows.Threading.Dispatcher.ProcessQueue() in ProcessQueue.il:line IL_00E5 mvid 1D26
     at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in WndProcHook.il:line IL_003A mvid 1D26
     at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in WndProc.il:line IL_0023 mvid 1D26
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) in DispatcherCallbackOperation.il:line IL_0036 mvid 1D26
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in InternalRealCall.il:line IL_0076 mvid 1D26
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in TryCatchWhen.il:line IL_0002 mvid 1D26
     at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) in LegacyInvokeImpl.il:line IL_00BC mvid 1D26
     at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) in SubclassWndProc.il:line IL_010A mvid 1D26
     at JetBrains.Interop.WinApi.User32Dll.DispatchMessageW(MSG* lpmsg)
     at JetBrains.Interop.WinApi.User32Dll.DispatchMessageW(MSG* lpmsg)
     at JetBrains.Util.Concurrency.WinDispatcherImpl.WindowsDispatcherPlatformSpecific.InternalPumpMessagesOnce() in InternalPumpMessagesOnce.il:line IL_0020 mvid D9B8
     at JetBrains.Threading.JetDispatcher.<>c__DisplayClass47_0.<Run>b__0(IJetDispatcherPlatformSpecific staticMethods, TimeSpan t, Boolean _) in JetDispatcher.il:line IL_0000 mvid D9B8
     at JetBrains.Threading.JetDispatcher.RunAndRestartIfNeeded(TimeSpan timeout, Boolean bThrowOnTimeout, Func`4 runLoopAction) in RunAndRestartIfNeeded.il:line IL_0059 mvid D9B8
     at JetBrains.Threading.JetDispatcher.Run(IProperty`1 condition, TimeSpan timeout, Boolean bThrowOnTimeout) in Run.il:line IL_0027 mvid D9B8
     at JetBrains.Application.Environment.IJetHostEx.<>c__DisplayClass3_0.<RunHostMessageLoop>b__0(Lifetime lifetime) in IJetHostEx.il:line IL_0025 mvid BE77
     at JetBrains.Lifetimes.Lifetime.Using(Action`1 action) in Using.il:line IL_0014 mvid CC54
     at JetBrains.Application.Environment.IJetHostEx.RunHostMessageLoop(IComponentContainer containerEnv) in RunHostMessageLoop.il:line IL_0030 mvid BE77
     at JetBrains.Application.Environment.HostParameters.MessagePumpMainLoopHostMixin.JetBrains.Application.Environment.HostParameters.IRunMainLoopHostMixin.RunMainLoop(ComponentContainer containerEnv)
     at JetBrains.Application.Environment.HostParameters.JetHostParametersCaller.RunMainLoop(ComponentContainer containerEnv) in RunMainLoop.il:line IL_009F mvid BE77
     at JetBrains.Application.Environment.JetEnvironment.InternalRun(JetHostParametersCaller host, ComponentContainer containerEnv) in InternalRun.il:line IL_0010 mvid BE77
     at JetBrains.Application.Environment.JetEnvironment.CreateAndRun(Full hostparams) in CreateAndRun.il:line IL_002E mvid BE77
     at JetBrains.Application.Environment.JetHostItems.CreateAndRun(Full input) in CreateAndRun.il:line IL_000E mvid BE77
     at JetBrains.Rider.Backend.Product.RiderBackendProgram.MainX(Assembly assembly, HostInfo hostInfo, String[] args) in MainX.il:line IL_00C7 mvid AADC
     at JetBrains.Rider.Backend.Product.RiderBackendProgram.<>c.<Main>b__3_0(Lifetime lifetime) in RiderBackendProgram.il:line IL_002B mvid AADC
     at JetBrains.Lifetimes.Lifetime.Using[T](Func`2 action) in Using.il:line IL_0014 mvid CC54
     at JetBrains.Rider.Backend.Product.RiderBackendProgram.Main() in Main.il:line IL_0045 mvid AADC
”

Seems like TestHost from our library somehow is in conflict with the plugin. Not sure as to why. Do you happen to see why from the stacktrace?

pmihalcin avatar Jan 11 '24 07:01 pmihalcin