machine / machine.specifications

Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
MIT License
885 stars 178 forks source link

Machine.Specifications test can't run with new project format from VS/Resharper Unit Test window #348

Closed penderi closed 5 years ago

penderi commented 6 years ago

Hi, We are looknig to target .Net Core in the near future. Sometime ago we upgraded all our projects to the 'new' csproj format. For 6 months we've had test discovery issues. VS / R# doesn't 'see' the MSpec unit tests. If I rebuild / close /open files that can work. But it's laborious. Indeed the expereince is so bad we're about to migrate 2500 mspec tests as we are unable to dev.

I was hoping successive mspec / runner / resharper / VS updates would help. Neither have. I've followed the advice of adding the VSTest MSpec packages and Test.SDK. No difference. dotnet test works everytime mspec command line runner works everytime

I see the following problems:

r# Unit test sessions -> "WARN Run: 153ec4a6-7d0f-4ddb-888e-875bef572805 - Cannot find element for task of type ". This is a warning in the Unit Tests Sessions window.

Build Output (Tests) -> [22/02/2018 15:33:16 Informational] Machine Specifications Visual Studio Test Adapter - Discovering...looking in D:\dev\huddle\babble\src\Huddle.ReplyByEmail.UnitTests\bin\Debug\net461\Huddle.ReplyByEmail.UnitTests.dll [22/02/2018 15:33:17 Error] Machine Specifications Visual Studio Test Adapter - Error while discovering specifications in assembly D:\dev\huddle\babble\src\Huddle.ReplyByEmail.UnitTests\bin\Debug\net461\Huddle.ReplyByEmail.UnitTests.dll - Exception of type 'System.OutOfMemoryException' was thrown.

We're rather desperate and would like to use our existing code. Any help gratefully received.

penderi commented 6 years ago

I've verbose resharper logs. Here's the exceptions:

--- EXCEPTION #1/2 [COMException] Message = “Member not found. The error code is DISP_E_MEMBERNOTFOUND, or 0x80020003.” ExceptionPath = Root.InnerException ClassName = System.Runtime.InteropServices.COMException HResult = DISP_E_MEMBERNOTFOUND=80020003 Source = JetBrains.Platform.VisualStudio.Core StackTraceString = “

 at JetBrains.VsIntegration.Interop.Shim.VsShell.Shell.IVsWindowFrame.GetProperty[TValue](VSFPROPID propid)
     at JetBrains.VsIntegration.IDE.Documents.Whidbey.VsDocumentManagerWhidbey.<>c__DisplayClass38.<>c__DisplayClass3d.<OnTextManagerRegisterView>b__36()
     at JetBrains.Util.Logging.Logger.CatchSilent(Action action)

--- Outer ---

--- EXCEPTION #2/2 [LoggerException] Message = “Member not found. The error code is DISP_E_MEMBERNOTFOUND, or 0x80020003.” ExceptionPath = Root ClassName = JetBrains.Util.LoggerException InnerException = “Exception #1 at Root.InnerException” HResult = COR_E_APPLICATION=80131600 StackTraceString = “

  at JetBrains.VsIntegration.IDE.Documents.Whidbey.VsDocumentManagerWhidbey.<>c__DisplayClass38.<OnTextManagerRegisterView>b__33()
     at JetBrains.Application.Threading.IShellLocksEx.ExecuteWithReadLock(IShellLocks thіs, Action F)
     at JetBrains.VsIntegration.IDE.Documents.Whidbey.VsDocumentManagerWhidbey.<>c__DisplayClass1c.<ExecuteOrQueueOrMergeUnguardedCallbackWithLog>b__1b()
     at JetBrains.Util.LogCookie.Execute(String comment, Action F)
     at JetBrains.VsIntegration.IDE.Documents.Whidbey.VsDocumentManagerWhidbey.<>c__DisplayClass1c.<ExecuteOrQueueOrMergeUnguardedCallbackWithLog>b__1a()
     at JetBrains.Util.Concurrency.UnguardedCallbackMerger.<>c__DisplayClass3.<ExecuteOrQueueOrMerge>b__0()
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
     at JetBrains.Threading.ReentrancyGuard.TryExecute(String name, Action action)
     at JetBrains.Threading.ReentrancyGuardEx.ExecuteOrQueue(ReentrancyGuard thіs, Lifetime lifetime, String name, Action F, TaskPriority priority)
     at JetBrains.Util.Concurrency.UnguardedCallbackMerger.ExecuteOrQueueOrMerge(Lifetime lifetimeQueue, String name, Action F)
     at JetBrains.VsIntegration.IDE.Documents.Whidbey.VsDocumentManagerWhidbey.ExecuteOrQueueOrMergeUnguardedCallbackWithLog(String eventName, VSCOOKIE docCookie, Action action)
     at JetBrains.VsIntegration.IDE.Documents.Whidbey.VsDocumentManagerWhidbey.OnTextManagerRegisterView(IVsTextView view)
     at JetBrains.DataFlow.Signal`1.NotifySinks(TValue payload)
     at JetBrains.DataFlow.Signal`1.Fire(TValue value, Object cookie)
     at JetBrains.DataFlow.Signal`1.Fire(TValue value)
     at JetBrains.VsIntegration.Interop.Events.TextControls.VsTextManagerEvents.Sink.Microsoft.VisualStudio.TextManager.Interop.IVsTextManagerEvents.OnRegisterView(IVsTextView pView)
     at Microsoft.VisualStudio.TextManager.Interop.IVsTextManager.RegisterView(IVsTextView pView, IVsTextBuffer pBuffer)
     at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Init_InitializeWpfTextView()
     at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Init_OnActivation()
     at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.PreOuterQueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds)
     at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.QueryStatus(Guid& pguidCmdGroup, UInt32 commandCount, OLECMD[] prgCmds, IntPtr commandText)
     at Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
     at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
     at Microsoft.VisualStudio.Shell.Interop.IVsUIObject.get_Data(Object& pVar)
     at Microsoft.Internal.VisualStudio.PlatformUI.Utilities.GetObjectData(IVsUIObject obj)
     at Microsoft.Internal.VisualStudio.PlatformUI.DataSource.GetValueForPresentation(String name, Object& varData, Boolean& dataRetrieved)
     at Microsoft.Internal.VisualStudio.PlatformUI.DataSource.GetValue(String name)
     at Microsoft.Internal.VisualStudio.PlatformUI.CustomPropertyInfo.GetValue(Object owner)
     at Microsoft.Internal.VisualStudio.PlatformUI.CustomPropertyInfoBase.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
     at System.Reflection.PropertyInfo.GetValue(Object obj, Object[] index)
     at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
     at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)
     at MS.Internal.Data.PropertyPathWorker.RawValue()
     at MS.Internal.Data.ClrBindingWorker.RawValue()
     at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
     at System.Windows.Data.BindingExpression.Activate(Object item)
     at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
     at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
     at System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
     at System.Windows.StyleHelper.GetInstanceValue(UncommonField`1 dataField, DependencyObject container, FrameworkElement feChild, FrameworkContentElement fceChild, Int32 childIndex, DependencyProperty dp, Int32 i, EffectiveValueEntry& entry)
     at System.Windows.StyleHelper.GetChildValueHelper(UncommonField`1 dataField, ItemStructList`1& valueLookupList, DependencyProperty dp, DependencyObject container, FrameworkObject child, Int32 childIndex, Boolean styleLookup, EffectiveValueEntry& entry, ValueLookupType& sourceType, FrameworkElementFactory templateRoot)
     at System.Windows.StyleHelper.GetChildValue(UncommonField`1 dataField, DependencyObject container, Int32 childIndex, FrameworkObject child, DependencyProperty dp, FrugalStructList`1& childRecordFromChildIndex, EffectiveValueEntry& entry, ValueLookupType& sourceType, FrameworkElementFactory templateRoot)
     at System.Windows.StyleHelper.GetValueFromStyleOrTemplate(FrameworkObject fo, DependencyProperty dp, EffectiveValueEntry& entry)
     at System.Windows.StyleHelper.ApplyStyleOrTemplateValue(FrameworkObject fo, DependencyProperty dp)
     at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList`1& exclusionContainerDependents, FrugalStructList`1& oldContainerDependents, FrugalStructList`1& newContainerDependents)
     at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
     at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
     at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
     at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
     at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
     at Microsoft.VisualStudio.PlatformUI.VsToolBar.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
     at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
     at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
     at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
     at System.Windows.FrameworkElement.UpdateStyleProperty()
     at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
     at System.Windows.FrameworkElement.TryFireInitialized()
     at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
     at System.Windows.FrameworkElement.AddLogicalChild(Object child)
     at System.Windows.Controls.ToolBarTray.ToolBarCollection.InsertItem(Int32 index, ToolBar toolBar)
     at System.Collections.ObjectModel.Collection`1.Add(T item)
     at Microsoft.VisualStudio.PlatformUI.VsToolBarTray.ProcessToolBarModels(IEnumerable toolBarModels)
     at Microsoft.VisualStudio.PlatformUI.VsToolBarTray.OnItemsSourceChanged(DependencyPropertyChangedEventArgs args)
     at Microsoft.VisualStudio.PlatformUI.VsToolBarTray.OnItemsSourceChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
     at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
     at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
     at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
     at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
     at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
     at Microsoft.VisualStudio.Platform.WindowManagement.BaseToolbarHost.AddToolbar(UInt64 id, VSTWT_LOCATION location, IDropTarget dropTarget, IOleCommandTarget commandTarget, Boolean copyToolbarData)
     at Microsoft.VisualStudio.Platform.WindowManagement.BaseToolbarHost.AddToolbar(VSTWT_LOCATION location, Guid& toolbarGuid, UInt32 toolbarId)
     at Microsoft.VisualStudio.Shell.Interop.IVsWindowFrameNotify.OnShow(Int32 fShow)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.<>c__DisplayClass514_0.<NotifyOnShow>b__0()
     at Microsoft.VisualStudio.ErrorHandler.CallWithCOMConvention(Func`1 method, Boolean reportError, Boolean setShellErrorInfo)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.NotifyOnShow(Int32 frameShow)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ShowInternal(ShowFlags showFlags)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.viewManager_ActiveViewChanged(Object sender, ActiveViewChangedEventArgs e)
     at Microsoft.VisualStudio.PlatformUI.ExtensionMethods.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object source, TEventArgs args)
     at Microsoft.VisualStudio.PlatformUI.Shell.ViewManager.SetActiveView(View view, ActivationType type)
     at Microsoft.VisualStudio.PlatformUI.Shell.ViewManager.OnShowAndActivateAutoHiddenView(Object sender, ExecutedRoutedEventArgs args)
     at Microsoft.VisualStudio.PlatformUI.Shell.ViewManager.<>c.<.cctor>b__23_7(Object sender, ExecutedRoutedEventArgs args)
     at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
     at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
     at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
     at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
     at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
     at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
     at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
     at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
     at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
     at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
     at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
     at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
     at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
     at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
     at System.Windows.Controls.Primitives.ButtonBase.OnClick()
     at System.Windows.Controls.Button.OnClick()
     at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonDown(MouseButtonEventArgs e)
     at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
     at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
     at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
     at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
     at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
     at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
     at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
     at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
     at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
     at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
     at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
     at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
     at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
     at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
     at System.Windows.Input.InputManager.ProcessStagingArea()
     at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
     at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
     at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
     at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
     at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
     at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

penderi commented 6 years ago

Note. This is NOT a core application. New project format, net461.

ivanz commented 6 years ago

The OutOfMemoryException looks suspicious. @penderi Do you see the same out of memory problem if you run the tests on the command line via dotnet test?

@robertcoltheart FYI.

penderi commented 6 years ago

nope. dotnet test and Machine.Specifications.Runner.Console work without error. meanwhile I can't debug / use VS Cheers for a response tho' ! Beyond the point of desperation here....

robertcoltheart commented 6 years ago

I'll have a look through the code to see if there's any red flags, but I'd like input from R# team as well if possible, as I don't see any of the above issues with my solutions at work, which have similar sized numbers of spec tests. @citizenmatt what can we do in the way of logs or diagnostics for memory issues?

penderi commented 6 years ago

Any help gratefully received. Any debug I can provide do let me know.

citizenmatt commented 6 years ago

It sounds like you're getting the same error from both ReSharper and the Visual Studio test runner, which points to the VS test adapter, as both R# and VS use that to discover and run tests. And it looks like you've got verbose logs for R#, too. Feel free to forward them to me if you want. I don't know if there's a way to show the JSON messages being sent between R# and the test adapter - perhaps @estrizhok knows?

If there's an out of memory issue, I wonder if it's serialisation related? Are there any parameters that might confuse a JSON serialiser?

penderi commented 6 years ago

Any idea if this will be looked at? I've not been able to run tests for a long time. Luckily we've been in maintenance mode for 6m but we're now starting to dev. Not running tests without 3 or 4 full rebuilds is killing us. IF we don't know how to help / if it will be addressed we have no choice but to start moving 3K tests to n/x unit.

ivanz commented 6 years ago

@penderi I feel your pain, but the ReSharper extension and MSpec are OSS projects, which are ran on best effort basis without commercial backing. If this is such a high priority issue for you and is blocking you from development, then I am sure @robertcoltheart will appreciate your hands-on help to reproduce and resolve the issue. The code repos are as follows:

penderi commented 6 years ago

Ah @ivanz I wasn't trashing the OSS nature. tbh I should have raised this 9months ago - when we first moved to the new project format. It's a long-standing problem I fear and it's my bad I should have raised it earlier.

I do have a wonder how others are working with MSpec. I fear:

The reality is I'll be starting the x days migration as we haven't been able to TDD for a very long time and it's harming our development.

If I can help then sure I can send details. I suspect its bad form for me to simply copy this thread. How do issues get coordinated across all 3 repos usually?

BrunoJuchli commented 6 years ago

@penderi We've been a long time user of mspec but in June 2016 we migrated to xunit. The team has kept the mspec syntax (with some adaptions) and wrote a Fody Weaver to create most of the necessary plumbing so that an "mspec"-style test becomes a xunit test with ctor, IDisposable and [Fact]'s.

Since November 2016 this plumbing has been stable apart from occasional updates of dependencies (9 times over the duration of 16 months).

Caveat: Support for Behavior's has been dropped.

Hence I'm wondering whether it wouldn't be more efficient to make the next mspec major release just a test-syntax with an adapter layer for 1 or 2 existing test runners (xunit, nunit).


In the grand scheme of things, however, I feel that mspec (and other testing syntaxes) prevent me from aggregating my test logic far too often. There's way too much code duplication in our test code. There's so much copy&paste. Maintaining spec/integration tests takes up a major part of my work time. Hence, personally, I feel mspec support is a legacy issue, for the future I'd envision something different.

I was looking forward to the extensibility provided by nunit 3.0/xunit 2.0. However, for xunit 2.0, the personally relevant runners (ReSharper, Rider,...) haven't picked up on these features and still use test-discovery of xunit 1.x. So due to lack of wide-spread adoption these extensibility features are completely wasted :'( AFAIR, with nunit 3.0 the picture looks similar (please correct me if i'm wrong).

If that would be different, an mspec-to-nunit adapter could probably be done without too much effort and one could forego the need to maintain runners, which has been almost all of the maintenance work for the past few years...(right?)

penderi commented 6 years ago

I'm not sure the best way forward and I've a vast amount of sympathy for mspec and the various contributors to each of the repos. I've seen the changes (forwards and backwards) with .Net Core over the last few years and it's more than difficult.

Now that the tooling and standards seem to be settling I'm hoping we can get renewed library efforts. MSpec integration with r# adds another later of compatibility issues too

robertcoltheart commented 6 years ago

I looked into this quite a bit with the R# addin, testing with 4,500+ unit tests and various combinations of old and new-style csproj projects. I feel your pain with this, but I came up empty, sorry. If you have the time and are able to reproduce with some test code, please attach it so I can investigate further.

penderi commented 6 years ago

Nice to know someone else has seen this. We have all new-form csproj and it's simply unworkable. I fear it's a problem with our code but just don't know. I've sent debug output in the past revealing an out of memory exception. I can try and gut the solution but it'll take time...

aptester commented 6 years ago

@BrunoJuchli Any chance you are going to open-source the xUnit variant of mspec? We too are blocked from adopting mspec if we can't debug tests.

BrunoJuchli commented 6 years ago

@aptester Will discuss this with management (you know, the code being owned by the company I work for and all).

aptester commented 6 years ago

@BrunoJuchli Thanks. Hoping for some positive news.

robertcoltheart commented 6 years ago

I believe this issue should be fixed, update to the latest VS runner/adapter and please let me know

penderi commented 6 years ago

I'm almost speechless. Buddy I'm off work but I had to try. Worked like a dream first time. I need to buy you a beer. First time I've been able to run tests in VS in a year. Thanks don't come close. I'm a little intrigued - what was the change? I'm guessing it was involved....

robertcoltheart commented 6 years ago

We use Mono.Cecil internally to determine the original source code line number of MSpec elements from the PDBs. The version of Cecil differed depending on whether you were using the dotnet core version or the NetFramework version. Turns out the older version of Cecil would get used in the situation where you were using the newer csproj format but targeting net461, for instance. This then (I think) triggered this issue https://github.com/jbevain/cecil/issues/282 and we get OutOfMemoryExceptions which failed the MSpec test discovery process silently.

TLDR: Cecil recently published the first stable 0.10.0 release in a long time with support for portable PDBs (and dotnet core), we bring our netcore and netframework versions inline with each other, voila 👍.