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

Object reference not set to an instance of an object when using url() in mixin #501

Closed
CodeTrailblazer opened this issue Mar 14, 2016 · 1 comment
Milestone

Comments

@CodeTrailblazer
Copy link

Hi, using the core library in the dotless.1.5.2 nuget package i'm having problems with mixins that use the css 'url()' function.

Having the sample:
`.cssClass
{
background-image:url('image.png');
}

.newCssClass
{
.cssClass;
color:#000;
}
`
and calling the parser's static method

dotless.Core.Less.Parse(sLessCss);
produces a "Object reference not set to an instance of an object" exception.

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
dotless.Core.Parser.Tree.Url.CloneCore() +57
dotless.Core.Parser.Infrastructure.Nodes.Node.Clone() +22
dotless.Core.Parser.Tree.Rule.CloneCore() +30
dotless.Core.Parser.Infrastructure.Nodes.Node.Clone() +22
dotless.Core.Parser.Infrastructure.Nodes.NodeList1.<CloneCore>b__0(TNode i) +19 System.Linq.WhereSelectListIterator2.MoveNext() +243
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +535
dotless.Core.Parser.Infrastructure.Nodes.NodeList`1.CloneCore() +404
dotless.Core.Parser.Infrastructure.Nodes.Node.Clone() +22
dotless.Core.Parser.Tree.MixinCall.Evaluate(Env env) +1229
dotless.Core.Utils.NodeHelper.ExpandNodes(Env env, NodeList rules) +130
dotless.Core.Parser.Tree.Ruleset.EvaluateRules(Env env) +291
dotless.Core.Parser.Tree.Ruleset.Evaluate(Env env) +253
dotless.Core.Parser.Tree.Ruleset.EvaluateRules(Env env) +686
dotless.Core.Parser.Tree.Root.Evaluate(Env env) +391
dotless.Core.Parser.Tree.Root.AppendCSS(Env env) +92
dotless.Core.Parser.Infrastructure.Output.Append(Node node) +69
dotless.Core.Parser.Infrastructure.Nodes.Node.ToCSS(Env env) +100
dotless.Core.LessEngine.TransformToCss(String source, String fileName) +481
dotless.Core.CacheDecorator.TransformToCss(String source, String fileName) +237
dotless.Core.ParameterDecorator.TransformToCss(String source, String fileName) +664
ASP.default_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:[WebProjects]\FlyableAC\Default.aspx:1331
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
System.Web.UI.Page.Render(HtmlTextWriter writer) +39
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +149
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5362

Any help is appreciated, thanks.

@rytmis
Copy link
Contributor

rytmis commented Mar 16, 2016

The stack trace looks like the Value property of the Url node is null. I'm not quite sure what that implies, so I'll have to debug this a bit at some point. Unfortunately I'm rather busy at the moment.

You can get around the problem by wrapping the URL in a quoted literal:

.cssClass
{
  background-image: ~"url('image.png')";
}

.newCssClass
{
  .cssClass;
  color:#000;
}

@rytmis rytmis closed this as completed in a76e649 Mar 20, 2016
@rytmis rytmis modified the milestone: 1.5.3 Mar 20, 2016
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