Git Product home page Git Product logo

emptyfiles's People

Contributors

0xced avatar actions-user avatar dependabot-preview[bot] avatar dependabot[bot] avatar gep13 avatar jankrivanek avatar ltrzesniewski avatar simoncropp avatar slang25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

emptyfiles's Issues

EmptyFiles.AllFiles ctor fails on .NET Framework

Describe the bug

Using an example from README with a .NET Framework 4.8 project fails with The type initializer for 'EmptyFiles.AllFiles' threw an exception. exception. I traced it to the AllFiles static constructor, which calls FindEmptyFilesDirectory. The function checks a couple of directory for the EmptyFiles folder, and it crashes if it can't find it.

The same code works as expected when I change the target framework in the project file from net48 to net7.

Here's an exception (running on Windows):

 Could not find empty files directory. Searched:
 * C:\Users\azima\AppData\Local\Temp\ReSharperTestRunner_ab0aedp5\bkphhiwt\EmptyFiles
 * C:\Users\azima\AppData\Local\Temp\ReSharperTestRunner_ab0aedp5\bkphhiwt\EmptyFiles

Stack trace:

    at EmptyFiles.AllFiles.FindEmptyFilesDirectory() in /_/src/EmptyFiles/AllFiles.cs:line 75
   at EmptyFiles.AllFiles..cctor() in /_/src/EmptyFiles/AllFiles.cs:line 42

Full stack trace (running on macOS):

 System.TypeInitializationException
 The type initializer for 'EmptyFiles.AllFiles' threw an exception.
  at DiffEngine.DiffRunner.TryCreate (DiffEngine.ResolvedTool tool, System.String targetFile) [0x00012] in C:\projects\diffengine\src\DiffEngine\DiffRunner.cs:198 
  at DiffEngine.DiffRunner.ShouldExitLaunch (DiffEngine.DiffRunner+TryResolveTool tryResolveTool, System.String targetFile, DiffEngine.ResolvedTool& tool, System.Nullable`1[DiffEngine.LaunchResult]& result) [0x0002f] in C:\projects\diffengine\src\DiffEngine\DiffRunner.cs:183 
  at DiffEngine.DiffRunner.InnerLaunchAsync (DiffEngine.DiffRunner+TryResolveTool tryResolveTool, System.String tempFile, System.String targetFile) [0x0001d] in C:\projects\diffengine\src\DiffEngine\DiffRunner.cs:131 
  at VerifyEngine.ProcessNew () [0x000cf] in /_/src/Verify/Verifier/VerifyEngine.cs:233 
  at VerifyEngine.ThrowIfRequired () [0x000cd] in /_/src/Verify/Verifier/VerifyEngine.cs:138 
  at VerifyTests.InnerVerifier.VerifyInner (System.Object root, System.Func`1[TResult] cleanup, System.Collections.Generic.IEnumerable`1[T] targets, System.Boolean doExpressionConversion) [0x00254] in /_/src/Verify/Verifier/InnerVerifier_Inner.cs:27 
  at VerifyTests.InnerVerifier.Verify (System.Object target) [0x0067d] in /_/src/Verify/Verifier/InnerVerifier_Object.cs:66 
  at VerifyXunit.Verifier+<>c__DisplayClass8_0.<Verify>b__0 (VerifyTests.VerifySettings verifySettings) [0x00054] in /_/src/Verify.Xunit/Verifier.cs:76 
  at Xunit.Sdk.TestInvoker`1+<>c__DisplayClass48_0[TTestCase].<InvokeTestMethodAsync>b__1 () [0x00154] in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:276 
  at Xunit.Sdk.ExecutionTimer.AggregateAsync (System.Func`1[TResult] asyncAction) [0x00031] in /_/src/xunit.execution/Sdk/Frameworks/ExecutionTimer.cs:48 
  at Xunit.Sdk.ExceptionAggregator.RunAsync (System.Func`1[TResult] code) [0x00025] in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:90 

 System.Exception
 Could not find empty files directory. Searched:
  * /var/folders/35/trnfg6ln5032dcp6tdg545dc0000gn/T/ReSharperTestRunner_z89mcdqq/7d0cglmx/EmptyFiles
  * /private/var/folders/35/trnfg6ln5032dcp6tdg545dc0000gn/T/ReSharperTestRunner_z89mcdqq/7d0cglmx/EmptyFiles
 
   at EmptyFiles.AllFiles.FindEmptyFilesDirectory () [0x00039] in /_/src/EmptyFiles/AllFiles.cs:75 
   at EmptyFiles.AllFiles..cctor () [0x000a5] in /_/src/EmptyFiles/AllFiles.cs:42

Minimal Repro

Using an example from README in a test project with XUnit targeting net48:

namespace TestProject1;

[UsesVerify]
public class Sample
{
    [Fact]
    public Task Test()
    {
        var person = ClassBeingTested.FindPerson();
        return Verify(person);
    }
}

public static class ClassBeingTested
{
    public static Person FindPerson() =>
        new()
        {
            Id         = new("ebced679-45d3-4653-8791-3d969c4a986c"),
            Title      = Title.Mr,
            GivenNames = "John",
            FamilyName = "Smith",
        };
}

public enum Title
{
    Mr,
    Mrs,
    Miss,
    Dr
}

public class Person {
    public Guid   Id         { get; set; }
    public Title  Title      { get; set; }
    public string GivenNames { get; set; }
    public string FamilyName { get; set; }
}

Submit a PR that fixes the bug

I am not sure what EmptyFiles does and maybe the issue needs to be moved to the EmptyFiles repo.

missing ", out result"

the file test.cs line 110 should read
Assert.False(AllFiles.TryGetPathFor("foo.txt", out result));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.