Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshooter is broken for .NET 4.6.2 projects #194

Closed
fgreinacher opened this issue Jan 8, 2024 · 2 comments
Closed

Snapshooter is broken for .NET 4.6.2 projects #194

fgreinacher opened this issue Jan 8, 2024 · 2 comments

Comments

@fgreinacher
Copy link
Contributor

fgreinacher commented Jan 8, 2024

Describe the bug

The changes from #188 (specifically the discussion #188 (comment)) broke scenarios where a NET Framework 4.6.2 test project references both Snapshooter as well NUnit 4. This happens because the Snapshooter build for .NET Standard 2.0 is compiled against NUnit 3.

To Reproduce

I made a minimal reproduction at https://github.com/fgreinacher/snapshooter-net462.

The failure can be seen at https://github.com/fgreinacher/snapshooter-net462/actions/runs/7449195601/job/20265287704:

  Error Message:
   System.MissingMethodException : Method not found: 'Void NUnit.Framework.Assert.That(!!0, NUnit.Framework.Constraints.IResolveConstraint)'.
  Stack Trace:
     at Snapshooter.NUnit.NUnitAssert.Assert(String expectedSnapshot, String actualSnapshot)
   at Snapshooter.SnapshotAssert.ExecuteSnapshotComparison(Boolean originalSnapshotExists, String actualSnapshotSerialized, String originalSnapshotSerialized, SnapshotFullName snapshotFullName, MatchOptions matchOptions)
   at Snapshooter.SnapshotAssert.AssertSnapshot(Object currentResult, SnapshotFullName snapshotFullName, MatchOptions matchOptions)
   at Snapshooter.NUnit.Snapshot.Match(Object currentResult, SnapshotFullName snapshotFullName, Func`2 matchOptions)
   at Snapshooter.NUnit.Snapshot.Match[T](T currentResult, Func`2 matchOptions)
   at snapshooter_net462.Tests.Test1() in D:\a\snapshooter-net462\snapshooter-net462\UnitTest1.cs:line 12

Expected behavior

This should work as both NUnit 4 and Snapshooter support .NET Framework 4.6.2

Desktop (please complete the following information):

  • OS: Windows
  • Version: Any
@fgreinacher
Copy link
Contributor Author

fgreinacher commented Jan 8, 2024

Microsoft suggests this:

✔️ CONSIDER multi-targeting even if your source code is the same for all targets, when your project has any library or package dependencies.

✔️ CONSIDER adding a target for net462 when you're offering a netstandard2.0 target.

Therefore I'd recommend to add a net462 target (which is still supported by NUnit 4).

WDYT @RohrerF @PascalSenn @daghsentinel?

@RohrerF
Copy link
Member

RohrerF commented Jan 19, 2024

Should be fixed in v14.0.1

@RohrerF RohrerF closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants