U4-2045 - Issue U4-1300 seems to be un-fixed in 4.11.6

Created by Tim Payne 04 Apr 2013, 09:09:50 Updated by Sebastiaan Janssen 13 Apr 2013, 10:47:13

Relates to: U4-1300

Matt raised an issue wherby using Umbraco.TypedContent on an ID that was unpublished or in the recycle bin would cause a YSOD. This is down as fixed, however, in 4.11.6, it's displaying the same behaviour. To replicate, call Umbraco.TypedContent() on an id of something that's unpublished.

I haven't been able to test this on v6 yet, but the same issue may be present there as well.

Please can this be re-fixed ASAP, as it means anything using the MNTP can easily be broken by un-publishing something that's been selected.

Comments

Tom Madden 10 Apr 2013, 14:31:09

This is an issue in 4.11.5 as well


Sebastiaan Janssen 10 Apr 2013, 15:01:23

FYI: This wasn't un-fixed but only implemented for v6. I'll see if we can backport the changes though.


Sebastiaan Janssen 11 Apr 2013, 11:22:15

While I can't actually reproduce the problem (please post a snippet of your View so I can try it out), Shannon has copied over the fix for U4-1300 so it should be fixed in 4.11.7.

For what it's worth, the following seems to work fine, even if node 1050 is not published or does not exist.

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @

//Returns True, not a YSOD @(Umbraco.TypedContent(1050) == null)

I'll leave this open until I can verify the result with an actual code sample. Thanks!


Tom Madden 12 Apr 2013, 13:58:29

Sebastiaan, this will ysod. It's just a snippet so not a full example. I've additional checks to make sure that there are some nodes selected, and when passing in some ids, one of which is in the recycle bin, then I get a ysod. people is an mntp with data stored as csv.

Hope this helps

Tom

var people = Umbraco.Field("people").ToString().Split(','); @foreach (var person in people) { var item = Umbraco.TypedContent(person); //ysod is one of the content item is in the recycle bin //do stuff }


Sebastiaan Janssen 13 Apr 2013, 10:47:04

Thanks for the example, that helps a lot!

This is my current view, which works in 4.11.7 now (one of the nodes in the people list is in the recycle bin):

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @

@foreach (var person in people) { var item = Umbraco.TypedContent(person); if(item != null) { @item.Name
} }

In 4.11.6 this would throw an error:

Cannot implicitly convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.Core.Models.IPublishedContent'. An explicit conversion exists (are you missing a cast?)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot implicitly convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.Core.Models.IPublishedContent'. An explicit conversion exists (are you missing a cast?)


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 4.11.6

Due in version: 4.11.7

Sprint:

Story Points:

Cycle: