plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hi,
i'm creating a plugin for my site.I went  through the nopcommerce guide how to create plugins.when i run the code the following  error displays


System.NullReferenceException: Object reference not set to an instance of an object.

private static Assembly PerformFileDeploy(FileInfo plug)
Line 326:        {
Line 327:            if (plug.Directory.Parent == null)
Line 328:                throw new InvalidOperationException("The plugin directory for the " + plug.Name +
Line 329:                                                    " file exists in a folder outside of the allowed nopCommerce folder heirarchy");

System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

The error is displayed in plugin manager.cs file.The pluginfiles value donot assigned to mainplugin variable for my plugin only.
var mainPluginFile = pluginFiles

I put the plugin in the correct path only.that is inside the nop.web/presentation/plugin/....
Can anyone tell me why this error occurs?
10 years ago
Issues solved
10 years ago
Dear Thilak,
How to solved this error? I get it too and i can't fix.
:(
My error msg:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 323:        private static Assembly PerformFileDeploy(FileInfo plug)
Line 324:        {
Line 325:            if (plug.Directory.Parent == null)
Line 326:                throw new InvalidOperationException("The plugin directory for the " + plug.Name +
Line 327:                                                    " file exists in a folder outside of the allowed Umbraco folder heirarchy");


Source File: D:\..\Libraries\Nop.Core\Plugins\PluginManager.cs    Line: 325

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   Nop.Core.Plugins.PluginManager.PerformFileDeploy(FileInfo plug) in D:\..\Libraries\Nop.Core\Plugins\PluginManager.cs:325
   Nop.Core.Plugins.PluginManager.Initialize() in D:\..\Libraries\Nop.Core\Plugins\PluginManager.cs:136

[Exception: Object reference not set to an instance of an object.
]
   Nop.Core.Plugins.PluginManager.Initialize() in D:\..\Libraries\Nop.Core\Plugins\PluginManager.cs:186

[InvalidOperationException: The pre-application start initialization method Initialize on type Nop.Core.Plugins.PluginManager threw an exception with the following error message: Object reference not set to an instance of an object.
.]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +11567502
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +465
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167

[HttpException (0x80004005): The pre-application start initialization method Initialize on type Nop.Core.Plugins.PluginManager threw an exception with the following error message: Object reference not set to an instance of an object.
.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11556592
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4813333




Thanks you so much.
10 years ago
Hi,
Did you just copy the Model,Controller,View from another plugin?if yes means
Did you include the Model,Controller,View folder in your project?
I just made a fresh plugin in fresh project.
10 years ago
Thilak wrote:
Hi,
Did you just copy the Model,Controller,View from another plugin?if yes means
Did you include the Model,Controller,View folder in your project?
I just made a fresh plugin in fresh project.

Dear Thilak,
I just editd view, css and description file in plugin.
10 years ago
Hi,
Did you put the plugin in correct path?
Have you created a new plugin or modify the existing plugin?
7 years ago
I Had this issue recently

The problem was, i had same Description.txt for two different plugins

This happened Accidently while copying Description.txt from another plugin.

Make sure , SystemName , FriendlyName , FileName all shoul be unique for plugins.


Hope helps someone.
7 years ago
Especially the filename. I decided to change the project name after the first plugin compilation and forgot to edit the description.txt. Took me a while to find out why I had this error about the plugin folder being null. Putting the correct DLL filename helped a lot ...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.