3

Resolved

VirtualPathUtility.ToAppRelative NULL reference exception

description

In file: Orchard\DisplayManagement\Descriptors\ShapePlacementStrategy\ShapePlacementParsingStrategy.cs

Line: 142

VirtualPathUtility.ToAppRelative(ctx.Path ?? "")

VirtualPathUtility.ToAppRelative("") will throw a parameter null exception... I know its not null but but a empty string "" is not valid. hence the ?? "" is irrelevant

Not sure how the code should work but it could be changed to: VirtualPathUtility.ToAppRelative(ctx.Path ?? "/")

comments

planetClaire wrote Feb 6, 2013 at 7:20 AM

The suggested change seems to work for me.

Related issue: https://orchard.codeplex.com/workitem/18891 (which has been marked as fixed, but does not fix my issue)

My scenario: I have the following placement entry in my module:
<Match Path="~/LETS/Notice/*">
  <Place Parts_Title_Edit="Content:0"/>
</Match>
Since upgrading to V1.6 (from 1.4) I'm getting empty titles on all content types & paths; they are not set because of the null reference thrown as above.

By reversing the fix in issue 18891 and applying this change (the slash), the titles now work properly.

sebastienros wrote Jul 6, 2013 at 6:08 PM

Fixed in changeset 9245a661efa7

sfmskywalker wrote Mar 28 at 12:28 AM

Fixed in changeset 650864218a2f3b5bf77f9d594e4669d466309b32