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

MNTP: Exception with orphan node IDs #1

Closed
tomfulton opened this issue Oct 21, 2014 · 6 comments
Closed

MNTP: Exception with orphan node IDs #1

tomfulton opened this issue Oct 21, 2014 · 6 comments

Comments

@tomfulton
Copy link

One of my MNTP's has references to a node that no longer exists, which seems to cause the below exception when attempting to access:

ex

I think the exception is coming from the EntityService since we're passing it an invalid node ID.

I started to look at fixing this but wasn't sure how else we'd determine the UmbracoObjectType - other than a loop with some try/catches 😬

Any ideas, have you ran into this before?

@Jeavon
Copy link
Owner

Jeavon commented Oct 22, 2014

GetObjectType should return null for a deleted nodeId, if it's throwing then it's a core bug :) I'll have a look at core but probably best to add a try catch if it's throwing currently.

@Jeavon
Copy link
Owner

Jeavon commented Oct 23, 2014

@tomfulton I've tried to replicate with a unpublished and deleted node without success, any tips on how to replicate?

@tomfulton
Copy link
Author

Hey @Jeavon, I can replicate by passing a non-existing ID to:

ApplicationContext.Current.Services.EntityService.GetObjectType(3333333);

I was also able to reproduce in the Umbraco UI (7.1.6). It should happen once you delete the node from the Recycle Bin, and it's still selected on an MNTP. Is it not happening for you?

I think you're right that the core shouldn't throw for this, but even if they don't we may still have the same issue. Right now the PVC relies on this method to figure out what type of nodes it should request/return (Document/Media/Member). If the first node ID in the list is invalid (this was my case), the PVC won't know how to process the rest.

Maybe if the first ID doesn't exist, we fallback to the next, and so-on? And if all are invalid we return an empty list?

@Jeavon
Copy link
Owner

Jeavon commented Oct 28, 2014

Fixed (worked around) in v2.1.3

@Jeavon Jeavon closed this as completed Oct 28, 2014
@tomfulton
Copy link
Author

@Jeavon Thanks, works like a champ! 🍻

Hope to see this fixed in the core too. I'm following your pull request and U4-5698, nice work!

@Jeavon
Copy link
Owner

Jeavon commented Oct 31, 2014

Me too, think my workaround isn't very efficient but now I have a good fix for core, so hopefully Umbraco v7.2.1 I can revert :)

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