GithubHelp home page GithubHelp logo

Comments (4)

theramis avatar theramis commented on May 23, 2024

Hey @JinhongZh,

Thats an interesting use case. I did a quick test using method.DeclaringType.Assembly.Location rather than StackFrame.GetFileName() and I found that it unfortunately won't work.

method.DeclaringType.Assembly.Location returns the location of the dll which is the compiled code. Snapper needs to store the snapshots next to the code file not the generated dll.

Would it be possible for you to make an example project where this issue occurs and I can use that to figure out a solution.

from snapper.

JBrejnholt avatar JBrejnholt commented on May 23, 2024

Hi @theramis ,
Thanks for your swift reply :)
Yes, our use case is a bit special. We are trying to deploy a set of services in different environment, and we want to run the same snapshot tests against the services in those environments. Due to there are some parameters need to be updated accordingly, we have a PowerShell script to update the settings file first, and then execute the snapshot tests via "dotnet vstest XXTest.dll". Those all worked fine, until in one of the projects, where the setup was done in C# code, to keep the same workflow as it always do, we tried to execute the PowerShell script from the there, and then we hit the problem where the StackFrame.GetFileName() didn't work.
For packaging the snapshot test project nuget, we simply take the output from the dotnetcore publish folder and insert them as contentFiles (nuspec file), in this way we can inspect the folder layout and use the files directly when the nuget is been installed in the new project.
I will try to make an example project as you suggested, and let you know when it is ready.
Thanks :)

from snapper.

JBrejnholt avatar JBrejnholt commented on May 23, 2024

Hi again,
I tried to created two example projects to reproduce the problem we are facing, and then I found there were a problem when directly using the PowerShell class from System.Management.Automation nuget. The discovery made me think the way of executing the dll via Powershell might not be the best fit in this case. After I modified the project to use cmd.exe to execute the snapshot test dll, the problem went away.

I don't think there is a need to dig further in this special usage of the Snapper.

Thanks for the great tool by the way :)

from snapper.

fgather avatar fgather commented on May 23, 2024

Hi,

I've also run in this problem. It might be related to this:
dotnet/coreclr#14696

from snapper.

Related Issues (20)

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.