SitecorePowerShell / Console

Sitecore PowerShell Extensions
https://doc.sitecorepowershell.com/
Other
114 stars 70 forks source link

Powershell ISE throwing null reference exception #394

Closed joosthollander closed 9 years ago

joosthollander commented 9 years ago

Hi,

I Installed Sitecore PowerShell Extensions-3.1 for Sitecore 8 on our Sitecore 8 update 2 solution. When I start the powershell ISE I get a null reference exception (stack trace below). I also installed the same package on a clean installation of Sitecore 8 update 2 and there it works just fine so I guess it must be related to some customizations we did on our solution. Can you provide guidance on how to debug this issue or is it something you have seen before?

Kind Regards, Joost

15520 19:17:18 ERROR Application error. Exception: System.Web.HttpUnhandledException Message: Exception of type 'System.Web.HttpUnhandledException' was thrown. Source: System.Web at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Nested Exception

Exception: System.Reflection.TargetInvocationException Message: Exception has been thrown by the target of an invocation. Source: mscorlib at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Nested Exception

Exception: System.NullReferenceException Message: Object reference not set to an instance of an object. Source: Cognifide.PowerShell at Cognifide.PowerShell.Client.Applications.PowerShellIse.OnLoad(EventArgs e)

michaellwest commented 9 years ago

@joosthollander Do you encounter any issues in the Console?

joosthollander commented 9 years ago

Hi Michael,

The console seems to work just fine:

image

Regards, Joost

joosthollander commented 9 years ago

Hi Michael / Adam,

I do not fully understand whats happening but I have been able to fix the issue. We compiled the code and found out that the null reference exception was causes by the fact that the following item was not present in the core database: /sitecore/content/Applications/PowerShell/PowerShellIse/Menus/Sessions/ISE editing session

I created this item and used the binaries which we compiled and now ISE works.

regards, Joost

michaellwest commented 9 years ago

Joost, I just confirmed that this item was introduced with issue #382. The item was added to source control but is missing from the package. I'll take a look and see if I can correct the deployed module on the marketplace.

michaellwest commented 9 years ago

@joosthollander In your original comment that you installed SPE 3.1 did a previous version exist in Sitecore you were simply upgrading? If so, what version?

I did confirm that in a clean install of both SC 8 up2 and SC 8 up3 the module works without error.

alan-null commented 9 years ago

Hi @joosthollander,

Your problem is probably related to #378. From this screen I can see that Home item is not present in your database.

Please install a package with default home item, or create the new one (path to the home item must be the same as on vanilla Sitecore instance).

This problem was already solved, but the current release doesn't contain those changes.

Hope it helps.

joosthollander commented 9 years ago

Hi,

This may very well be the case. The home item is indead missing. And same package on same machine on a fresh install (with sitecore home item) did work. @michaellwest There was no previous version and the issue also occurred on a different dev env with the same setup.

Thanks for your help!

Regards, Joost

AdamNaj commented 9 years ago

Closing as solved. Fixed with Issue #378

jayasimhas commented 7 years ago

Hi Team

I do have Home item in my Tree, but i'm getting this error. try to open any item in the path ex: /sitecore/system/Modules/PowerShell

is throwing null reference exception.

jayasimhas commented 7 years ago

Stake trace: [NullReferenceException: Object reference not set to an instance of an object.] Sitecore.XA.Foundation.Editing.Commands.PreviewItem.RunPreview(ClientPipelineArgs args, Item item) +658 Sitecore.XA.Foundation.SitecoreExtensions.VersionDecoupling.CurrentVersion.IsAtLeast(Version requiredVersion, Action actionIfAtLeast) +43 Sitecore.XA.Foundation.Editing.Commands.PreviewItem.Run(ClientPipelineArgs args) +264

[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146 Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89 Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline) +301 Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic) +176 Sitecore.Web.UI.Sheer.ClientPage.RunPipelines() +503 Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +779 Sitecore.Shell.Applications.ContentManager.ContentEditorPage.OnPreRender(EventArgs e) +24 System.Web.UI.Control.PreRenderRecursiveInternal() +110 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2994

alan-null commented 7 years ago

Hey @jayasimhas

It doesn't look like SPE bug but something in SXA. Are you sure that you've installed everything properly?

You can look for help on slack channel #sxa or raise a Sitecore support ticket.

jayasimhas commented 7 years ago

Ok , will do. Thanks for the response.

From: Alan Płócieniak [mailto:notifications@github.com] Sent: Monday, August 28, 2017 8:29 PM To: SitecorePowerShell/Console Cc: Suseela Sivanagare Jayasimha; Mention Subject: Re: [SitecorePowerShell/Console] Powershell ISE throwing null reference exception (#394)

Hey @jayasimhashttps://github.com/jayasimhas

It doesn't look like SPE bug but something in SXA. Are you sure that you've installed everything properly?

You can look for help on slack channel #sxa or raise a Sitecore support ticket.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/SitecorePowerShell/Console/issues/394#issuecomment-325454440, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AT9NxQtJQFQwPg6AVsv5ho4XBWFGAPgCks5scxUBgaJpZM4FPLd7.

santoshyerramilli commented 7 years ago

Hi , With SPE 4.7 we are facing below issue

Invoke-RemoteScript : The script session with Id '83a20292-fa6f-430a-8dda-26de70ec5997' cannot be found. At C:\Program Files\WindowsPowerShell\Modules\SPE\Wait-RemoteScriptSession.ps1:73 char:21

VERBOSE: Polling job . Status : . VERBOSE: Finished polling job 83a20292-fa6f-430a-8dda-26de70ec5997. VERBOSE: Checking the Runspace for the variable id. Get-ScriptSession : The script session with Id '83a20292-fa6f-430a-8dda-26de70ec5997' cannot be found. At line:2 char:36

Thanks

alan-null commented 7 years ago

@santoshyerramilli This issue has been closed already. Please create a new one with our issue template and provide steps to reproduce.