FortuneN / FineCodeCoverage

Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage
Other
523 stars 40 forks source link

exception in FCC output, no coverage results displayed #268

Closed WieknotJesduit closed 2 years ago

WieknotJesduit commented 2 years ago

Installed product versions

Description

running test produces no coverage metrics see following error in FCC output Fine Code Coverage : Error test container discoverer reflection

Fine Code Coverage : Error processing unit test events System.Exception: Property Response with binding flags Instance, Public does not exist on Microsoft.VisualStudio.TestWindow.Controller.TestRunRequest at FineCodeCoverage.Impl.TestOperationFactory.Create(IOperation operation) in D:\a\FineCodeCoverage\FineCodeCoverage\SharedProject\Impl\TestContainerDiscovery\TestOperationFactory.cs:line 36 at FineCodeCoverage.Impl.TestContainerDiscoverer.ShouldConditionallyCollectWhenTestExecutionFinished(IOperation operation) in D:\a\FineCodeCoverage\FineCodeCoverage\SharedProject\Impl\TestContainerDiscovery\TestContainerDiscoverer.cs:line 149 at FineCodeCoverage.Impl.TestContainerDiscoverer.d__25.MoveNext() in D:\a\FineCodeCoverage\FineCodeCoverage\SharedProject\Impl\TestContainerDiscovery\TestContainerDiscoverer.cs:line 0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at FineCodeCoverage.Impl.TestContainerDiscoverer.d36.MoveNext() in D:\a\FineCodeCoverage\FineCodeCoverage\SharedProject\Impl\TestContainerDiscovery\TestContainerDiscoverer.cs:line 252 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at FineCodeCoverage.Impl.TestContainerDiscoverer.d37.MoveNext() in D:\a\FineCodeCoverage\FineCodeCoverage\SharedProject\Impl\TestContainerDiscovery\TestContainerDiscoverer.cs:line 260

Steps to recreate

run any unit test/s

Current behavior

tests run as expected, but not coverage results are rendered

Expected behavior

after running test/s, I expect to see coverage data displayed

tonyhallett commented 2 years ago

What version of the Microsoft.NET.Test.Sdk are you using ? Can you update to most recent and try again please.

WieknotJesduit commented 2 years ago

16.0.1 I cannot upgrade the version easily since this solution is shared with 100s of other developers. I do know it works with other developers, so I am just "special" somehow. :-)

WieknotJesduit commented 2 years ago

also the test project is net472

tonyhallett commented 2 years ago

FCC uses reflection to obtain hidden test explorer information. It is either Microsoft.NET.Test.Sdk or Visual Studio itself that determines the accessibility of the members. What version of Visual Studio are you using ? Perhaps you can update that ?

WieknotJesduit commented 2 years ago

VS 16.3.6 Looks like it doesn't have any new updates to install

WieknotJesduit commented 2 years ago

opened vs installer, and now I see it needs to be updated

tonyhallett commented 2 years ago

FCC is reflecting on TestRunRequest.

namespace Microsoft.VisualStudio.TestWindow.Controller
{
  internal class TestRunRequest : Request
  {
    private 
    #nullable disable
    Dictionary<Uri, List<Uri>> dataCollectorResults;

    internal TestRunRequest(Operation operation, TestRunConfiguration testRunConfig)
      : base(operation, (RequestConfiguration) testRunConfig)
    {
    }

    public TestRunResponse Response { get; private set; } = TestRunResponse.Default;

It is public in VS2022 17.1.0

C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestWindow.Core.dll

So should resolve itself when you have updated. ( It works with 2019 16.11.7)

I am in the middle of a substantial change to FCC. When I have completed it I will change the BindingFlags.

WieknotJesduit commented 2 years ago

upgraded to 16.11.15 and now it is working. Thank you very much!