U4-3925 - Cancel Document_BeforePublish event gives YSOD

Created by Allan Kirk 19 Dec 2013, 11:08:33 Updated by Sebastiaan Janssen 01 May 2014, 07:55:53

We have the same issue as here: http://our.umbraco.org/forum/developers/api-questions/45424-Cancel-Document_BeforePublish-event

--snip-- When I try to cancel the Document_BeforePublish event with e.Cancel = true I get a YSD.

We are using 6.1.5

The error message is:

[NullReferenceException: Object reference not set to an instance of an object.] umbraco.cms.presentation.editContent.ShowMessageForStatus(PublishStatus status) +58 umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e) +141 umbraco.controls.ContentControl.DoSaveAndPublish(Object sender, ImageClickEventArgs e) +158 --/snip--

Someone even found a solution: --snip-- Yes - we had to recompile the Umbraco source. You will find the affected file here: \src\umbraco.cms\businesslogic\web\Document.cs

Instead of

return Attempt.False;

we wrote

return new Attempt(false, new PublishStatus(Content, PublishStatusType.FailedCancelledByEvent));

You have to change two lines (1031 and 1034).

Cheers Tobias --/snip--

Comments

Allan Kirk 24 Dec 2013, 10:05:26

I'm not sure about the procedure here. It has been marked as fixed in Inline code, but it's not due in a version. Do I have to do anything to make sure this will be included in Umbraco 6.2.0?


Sebastiaan Janssen 01 May 2014, 07:55:42

Thanks! Fixed in rev c139c5d93e96


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Easy

Category: Extensibility

Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 6.1.5, 6.1.6

Due in version: 6.2.0

Sprint:

Story Points:

Cycle: