JoshKorn

This should be trivial, I know, but I can't get it to work to save my life :

I want a solution to include a feature receiver. It seems pretty straightforward: (using a HelloWorld template as an example), I include the following in feature.xml:

ReceiverAssembly="HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5"
ReceiverClass="HelloWorld.HWFeatureReceiver"

and the following code in assembly HelloWorld (which goes into the GAC):

namespace HelloWorld
{
public class HWFeatureReceiver : SPFeatureReceiver
{

...

}
}

and yet, when I attempt to deploy the solution, I get the following error:

Failed to create feature receiver object from assembly "HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5", type "HelloWorld.HWFeatureReceiver" for feature ae3bdef7-1f71-45a3-15fc-7e098c837cff: System.ArgumentNullException: Value cannot be null.

Parameter name: type

at System.Activator.CreateInstance(Type type, Boolean nonPublic)

at System.Activator.CreateInstance(Type type)

at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Troubleshoot issues with Windows SharePoint Services.

What gives

TIA for helping.

Josh



Re: SharePoint - Development and Programming What's wrong with this feature receiver?

JoshKorn

Found it. A bug in the otherwise very useful Sharepoint Project template kept putting an old version of the assembly in the .wsp file.





Re: SharePoint - Development and Programming What's wrong with this feature receiver?

wagswvu

I'm having the same issue that you posted, working through the same "HelloWorld example. How did you solve the problem

Thanks.





Re: SharePoint - Development and Programming What's wrong with this feature receiver?

simimol

I think It may be because of the wrong public key token you are using on it.Make sure that the key token dint changed .And check the namespaces you r using for the receiver class with the remaining solution files