-
-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Closed
Feature
Copy link
Labels
area-commandsInvolves functions and cmdlets.Involves functions and cmdlets.
Milestone
Description
Expected Behavior
No exceptions should occur when accepting VersionAddedNotification via PowerShell in Sitecore.
Actual Behavior
NullReferenceException occurs when trying to accept VersionAddedNotification via PowerShell in Sitecore.
It happens for cloned items after creating a new numbered version for its master item.
Steps to Reproduce the Problem
Steps to reproduce:
- Create a master item - /sitecore/content/Home/Sample Item
- Clone master item - /sitecore/content/Home/Clones/Sample Item
- Add a numbered version for the master item
- Run the below PS script
$item = (Get-Item -Path "/sitecore/content/Home/Clones/Sample Item" -Language "en")
Write-Host $item.Uri
Write-Host "------------------------------"
$notifications = Get-ItemCloneNotification -Item $item
$notifications | % { Write-Host $_.Type $_.VersionUri}
foreach ($notification in $notifications)
{
if ($notification -ne $null)
{
if ($notification.Type -eq "VersionAddedNotification" `
-and $notification.Type -ne "FirstVersionAddedNotification")
{
Write-Host $notification.ItemUri
Receive-ItemCloneNotification -Notification $notification -Action Accept
}
}
}
Debugging the source code, we detected the exception occurs in VersionAddedNotification.Accept method
when trying to invoke this.SendMessage - see attached pictures
The reason for the issue is HttpContext.Current is null.
It is reproduced not steadily - after several attempts, it could be successfully accepted.
But, each failed attempt adds a new version for the cloned item.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-commandsInvolves functions and cmdlets.Involves functions and cmdlets.


