0

I have a PowerShell code like this

Import-Function Validate-PowerShell

Test-PowerShell

Try
{
   $ctx = get-item .

   Import-Function Import-RedirectMappings
   $file = Receive-File (get-item "master:\media library\Files") -Title "Upload.." -Description "Upload file" -Overwrite    
       ... other code
}
Catch
{
   $ErrorRecord=$Error[0]
   Write-Log -Log Error $ErrorRecord
   Show-Alert "Something went wrong. See SPE logs for more details."
   Close-Window
}

in case Receive-File dialog files is not selected and press ok, user see exception:

[NullReferenceException: Object reference not set to an instance of an object.] Sitecore.UIUtil.GetBrowserClassString() +393
Sitecore.Shell.Controls.Standard.FormPageXmlControl.OnLoad(EventArgs e) +672 System.Web.UI.Control.LoadRecursive() +153
System.Web.UI.Control.LoadRecursive() +250
System.Web.UI.Control.LoadRecursive() +250
System.Web.UI.Control.LoadRecursive() +250
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4081

how it is possible to fix it ?

1

This appears to be an issue that has been around for some time now. I've reported this issue with the SPE Team.

There is now a fix in place due to be released with 5.1 which changes the alert to a validation message on the existing dialog.

SPE Validation Message

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.