I'm working on a UmbracoAPIController, something which worked fine in v7 seems to have trouble in v8.1
var a = Umbraco.ContentAtXPath("//docType[@isDoc]");
Results in:
System.ArgumentNullException: 'Value cannot be null.
Parameter name: doc'
var b = Umbraco.Content(1234);
This is the same content and works fine.
The content in question has no doctype props. Just a name and assigned template.
Stack Trace:
at Umbraco.Web.Macros.PublishedContentHashtableConverter..ctor(IPublishedContent doc) in d:\a\1\s\src\Umbraco.Web\Macros\PublishedContentHashtableConverter.cs:line 57 at Umbraco.Web.Macros.MacroRenderer.Render(String macroAlias, IPublishedContent content, IDictionary2 macroParams) in d:\a\1\s\src\Umbraco.Web\Macros\MacroRenderer.cs:line 200 at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.<>c__DisplayClass4_1.b__1(String macroAlias, Dictionary2 macroAttributes) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 56 at Umbraco.Web.Macros.MacroTagParser.ParseMacros(String text, Action1 textFoundCallback, Action2 macroFoundCallback) in d:\a\1\s\src\Umbraco.Web\Macros\MacroTagParser.cs:line 194 at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.RenderRteMacros(String source, Boolean preview) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 51 at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, Object source, Boolean preview) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 81 at Umbraco.Core.Models.PublishedContent.PublishedPropertyType.ConvertSourceToInter(IPublishedElement owner, Object source, Boolean preview) in d:\a\1\s\src\Umbraco.Core\Models\PublishedContent\PublishedPropertyType.cs:line 208 at Umbraco.Web.PublishedCache.NuCache.Property.GetInterValue(String culture, String segment) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Property.cs:line 192 at Umbraco.Web.PublishedCache.NuCache.Property.GetXPathValue(String culture, String segment) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Property.cs:line 232 at Umbraco.Web.PublishedCache.NuCache.Navigable.NavigableContent.Value(Int32 index) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Navigable\NavigableContent.cs:line 74 at Umbraco.Core.Xml.XPath.NavigableNavigator.MoveToFirstChildProperty() in d:\a\1\s\src\Umbraco.Core\Xml\XPath\NavigableNavigator.cs:line 602 at Umbraco.Core.Xml.XPath.NavigableNavigator.MoveToFirstChild() in d:\a\1\s\src\Umbraco.Core\Xml\XPath\NavigableNavigator.cs:line 562 at MS.Internal.Xml.XPath.XPathDescendantIterator.MoveNext() at MS.Internal.Xml.XPath.DescendantQuery.Advance() at MS.Internal.Xml.XPath.FilterQuery.Advance() at MS.Internal.Xml.XPath.XPathSelectionIterator.MoveNext() at Umbraco.Web.PublishedCache.NuCache.ContentCache.d31.MoveNext() in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentCache.cs:line 358 at DITAppService.Controllers.KickstartQuestionsController.GetKickstartQuestions() in C:\Users\dpuddifoot\Source\Repos\DITExportingGreatAppService\DITAppService\DITAppService\Controllers\KickstartQuestionsController.cs:line 27 at lambdamethod(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass62.b__2(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
I'm migrating from 7 to 8 and the same issue is popping up anytime an RTE field has to be rendered.
I noticed my macro was using Umbraco.TextboxMultiple instead of the new alias Umbraco.TextArea.
After changing the Macro Parameter Editor to Umbraco.TextArea, nothing changed unfortunately, but it may be related... not sure.
Using .ToList() was absolutely necessary on other places in my code.
Though it didn't resolve the issue in this location.
Using umbracoContext.Content.GetByRoute(...); did work as an alternative querying method.
This was suggested by Sebastiaan on the GitHub link above.
V8.1 Umbraco.ContentAtXPath Bug?
Hi,
I'm working on a UmbracoAPIController, something which worked fine in v7 seems to have trouble in v8.1
var a = Umbraco.ContentAtXPath("//docType[@isDoc]");
Results in:
System.ArgumentNullException: 'Value cannot be null. Parameter name: doc'
var b = Umbraco.Content(1234);
This is the same content and works fine.
The content in question has no doctype props. Just a name and assigned template.
Stack Trace:
at Umbraco.Web.Macros.PublishedContentHashtableConverter..ctor(IPublishedContent doc) in d:\a\1\s\src\Umbraco.Web\Macros\PublishedContentHashtableConverter.cs:line 57 at Umbraco.Web.Macros.MacroRenderer.Render(String macroAlias, IPublishedContent content, IDictionary
2 macroParams) in d:\a\1\s\src\Umbraco.Web\Macros\MacroRenderer.cs:line 200 at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.<>c__DisplayClass4_1.b__1(String macroAlias, Dictionary
2 macroAttributes) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 56 at Umbraco.Web.Macros.MacroTagParser.ParseMacros(String text, Action1 textFoundCallback, Action
2 macroFoundCallback) in d:\a\1\s\src\Umbraco.Web\Macros\MacroTagParser.cs:line 194 at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.RenderRteMacros(String source, Boolean preview) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 51 at Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, Object source, Boolean preview) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\RteMacroRenderingValueConverter.cs:line 81 at Umbraco.Core.Models.PublishedContent.PublishedPropertyType.ConvertSourceToInter(IPublishedElement owner, Object source, Boolean preview) in d:\a\1\s\src\Umbraco.Core\Models\PublishedContent\PublishedPropertyType.cs:line 208 at Umbraco.Web.PublishedCache.NuCache.Property.GetInterValue(String culture, String segment) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Property.cs:line 192 at Umbraco.Web.PublishedCache.NuCache.Property.GetXPathValue(String culture, String segment) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Property.cs:line 232 at Umbraco.Web.PublishedCache.NuCache.Navigable.NavigableContent.Value(Int32 index) in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\Navigable\NavigableContent.cs:line 74 at Umbraco.Core.Xml.XPath.NavigableNavigator.MoveToFirstChildProperty() in d:\a\1\s\src\Umbraco.Core\Xml\XPath\NavigableNavigator.cs:line 602 at Umbraco.Core.Xml.XPath.NavigableNavigator.MoveToFirstChild() in d:\a\1\s\src\Umbraco.Core\Xml\XPath\NavigableNavigator.cs:line 562 at MS.Internal.Xml.XPath.XPathDescendantIterator.MoveNext() at MS.Internal.Xml.XPath.DescendantQuery.Advance() at MS.Internal.Xml.XPath.FilterQuery.Advance() at MS.Internal.Xml.XPath.XPathSelectionIterator.MoveNext() at Umbraco.Web.PublishedCache.NuCache.ContentCache.d31.MoveNext() in d:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\ContentCache.cs:line 358 at DITAppService.Controllers.KickstartQuestionsController.GetKickstartQuestions() in C:\Users\dpuddifoot\Source\Repos\DITExportingGreatAppService\DITAppService\DITAppService\Controllers\KickstartQuestionsController.cs:line 27 at lambdamethod(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass62.b__2(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)Tried using DI for context.
GetByXpath failed with same error.
However GetByContentType worked
I'm migrating from 7 to 8 and the same issue is popping up anytime an RTE field has to be rendered. I noticed my macro was using Umbraco.TextboxMultiple instead of the new alias Umbraco.TextArea. After changing the Macro Parameter Editor to Umbraco.TextArea, nothing changed unfortunately, but it may be related... not sure.
I submitted an issue on GitHub.
Have you tried
Both work fine for me
Using .ToList() was absolutely necessary on other places in my code. Though it didn't resolve the issue in this location.
Using
umbracoContext.Content.GetByRoute(...);
did work as an alternative querying method. This was suggested by Sebastiaan on the GitHub link above.I'm getting this same error when trying to render Rich Text area content to an API Controller.
The Error only happens when the Rich Text Area contains a Macro. If its just plain text the API controller works just fine.
I've also noticed if I render the content through a normal view first, the API controller will work after that until the node is republished.
Which version of umbraco are you on?
Was on 8.1.0, just upgraded to 8.3.0. Still seeing the issue, but may need to republish all the content or macro definitions to fix it
The same issue I was encountering was fixed in 8.1.4. Try republishing. GitHub issue here.
is working on a reply...