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

Behaviors are broken in Resharper #459

Closed mikeblakeuk closed 2 years ago

mikeblakeuk commented 2 years ago

Using VS2022 17.0.2 with R# 2022.3 windows 10 (Also broken in rider)

image

Note, if you comment out //Behaves_like it appears to work.

System.InvalidCastException: Unable to cast object of type 'Machine.Specifications.Runner.ReSharper.Elements.MspecContextSpecificationTestElement' to type 'Machine.Specifications.Runner.ReSharper.Elements.MspecBehaviorSpecificationTestElement'. at Machine.Specifications.Runner.ReSharper.UnitTestElementFactory.GetOrCreateBehaviorSpecification(MspecBehaviorTestElement behavior, String fieldName, String ignoreReason) at Machine.Specifications.Runner.ReSharper.MspecTestMetadataExplorer.ExploreBehavior(MspecContextTestElement contextElement, IFieldInfo field) at Machine.Specifications.Runner.ReSharper.MspecTestMetadataExplorer.ExploreContext(ITypeInfo type) at Machine.Specifications.Runner.ReSharper.MspecTestMetadataExplorer.ExploreAssembly(IMetadataAssembly assembly, CancellationToken token) at JetBrains.ReSharper.UnitTestFramework.Exploration.Artifacts.MetadataElementsSource.ExploreProject(IProject project, FileSystemPath outputPath, MetadataLoader loader, ILogger logger, CancellationToken cancellationToken, Action`1 exploreAssembly) at Machine.Specifications.Runner.ReSharper.MspecTestExplorerFromMetadata.ProcessProject(MetadataLoader loader, IUnitTestElementObserver observer, CancellationToken token) at JetBrains.ReSharper.UnitTestFramework.Exploration.Artifacts.UnitTestExplorerFrom.Metadata.ProcessProjectCore(IUnitTestElementObserver observer, CancellationToken token) at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at JetBrains.ReSharper.UnitTestFramework.Exploration.Artifacts.UnitTestExplorerFrom.DotNetArtifacts.Async.d__2.MoveNext()

mikeblakeuk commented 2 years ago

Hi Robert Any more thoughts on this?

Thanks mike

robertcoltheart commented 2 years ago

In progress here, feel free to subscribe for updates: https://github.com/machine/machine.specifications.runner.resharper/pull/198

robertcoltheart commented 2 years ago

This is fixed and released to the JB plugin marketplaces