question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cake Frosting Parent DirectoryPath Fails To Combine with Slash

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake Frosting

Cake version

1.1.0

Operating system

Linux, Windows

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

A NullReferenceException in the code sample below. However, that’s more the symptom than the cause. The problem appears to be that Cake Frosting is combining Directory("..") + Directory("temp") into "..temp" rather than "../temp" when you capture the context and then use expression bodied properties.

This may seem obscure, but I’m converting a large codebase of DSL Cake into Frosting and am looking for ways to accomplish it with minimal changes.

What is expected?

It should run to completion without an exception

Steps to Reproduce

Run this:

[TaskName("Fail")]
public class FailTask : FrostingTask<BuildContext>
{
    private BuildContext? _context;
    private DirectoryPath RootDir => _context.Directory("..");
    private DirectoryPath TestDir => RootDir + _context.Directory("temp");

    public override void Run(BuildContext context)
    {
        _context = context;
        context.GetFiles(TestDir + context.File("*.zip"));
    }
}

Output log

Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Cake.Core.IO.Globbing.GlobVisitor.VisitParent(ParentDirectoryNode node, GlobVisitorContext context)
   at Cake.Core.IO.Globbing.Nodes.ParentDirectoryNode.Accept(GlobVisitor visitor, GlobVisitorContext context)
   at Cake.Core.IO.Globbing.GlobVisitor.VisitRelativeRoot(RelativeRootNode node, GlobVisitorContext context)
   at Cake.Core.IO.Globbing.Nodes.RelativeRootNode.Accept(GlobVisitor globber, GlobVisitorContext context)
   at Cake.Core.IO.Globbing.GlobVisitor.Walk(GlobNode node, GlobberSettings settings)
   at Cake.Core.IO.Globber.Match(GlobPattern pattern, GlobberSettings settings)
   at Cake.Core.IO.GlobberExtensions.Match(IGlobber globber, GlobPattern pattern)
   at Cake.Common.IO.GlobbingAliases.GetFiles(ICakeContext context, GlobPattern pattern)
   ...

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lpricharcommented, May 12, 2021

Oh, of course! That makes sense. Thanks @augustoproiete, looking forward to the next release.

0reactions
cake-build-botcommented, Oct 7, 2021

🎉 This issue has been resolved in version v1.3.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

v1.3.0 Milestone
Cake Frosting Parent DirectoryPath Fails To Combine with Slash Bug. #3352 by lprichar was closed on Oct 6, 2021. 2 tasks done.
Read more >
Cake v1.2.0 released
Cake v1.2.0 released ... Version 1.2.0 of Cake has been released. ... #3352 Cake Frosting Parent DirectoryPath Fails To Combine with Slash.
Read more >
Cake v1.3.0 released
NET 6 SDK, as well as build Cake addins and modules targeting the ... #3352 Cake Frosting Parent DirectoryPath Fails To Combine with...
Read more >
Cake v1.3.0 released. Version 1.3.0 of Cake has been… | by Cake ...
RollForward; Cake NuGet packages now include a README with general information and ... #3352 Cake Frosting Parent DirectoryPath Fails To Combine with Slash....
Read more >
Cake.Frosting 2.0.0-rc0001
Make your feature addition or bug fix. Don't forget the unit tests. Send a pull request. Get in touch. Follow @cakebuildnet. Join the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found