Home > SharePoint Development > Problems with Feature Receivers

Problems with Feature Receivers

Using VSeWSS to deploy a Feature with a receiver class associated with it, you may encounter the following error when SharePoint attempts to instantiate your class:

Failed to create feature receiver object from assembly "<Assembly>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<Public Key Token>", type "<Namespace>.<Class>" for feature <Feature Guid>: 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()

The obvious things to check are that the class, namespace and assembly references are correct in your feature definition:

<Feature
    Id="<Guid>"
    Title="<Title>"
    ...
    ReceiverClass="<Namespace>.<Class>"
    ReceiverAssembly="<Assembly>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<Public Key Token>" >

Less obvious is the fact that the default key for your assembly generated by VSeWSS may be causing the problem.  Generate a new signing key for the assembly and retry deploying your feature; if nothing else works, this just might.

Advertisements
  1. April 21, 2009 at 2:43 am

    Resigning worked like a charm, thanks!

  2. veena
    April 24, 2009 at 5:53 am

    thanks, it helped me

  3. Ivo Vink
    July 28, 2009 at 11:41 am

    As allways, you’re a hero!

    Wouldn’t ever have thought of that option.

  4. December 16, 2009 at 10:04 am

    i had checked all the coding, and everything are same with what you suggested about, *hopeless mode on* finally i closed the project salution and visual studio, refresh and open visual studio and project again, right-click BUILD and DEPLOY, oh thx’s god theres no error anymore when i tried deploy, so happy 😀

  5. Katavary
    January 20, 2010 at 2:02 pm

    Another SOLUTION (its work for me) :
    1) Uninstall assembly from the GAC (gacutil /u )
    2) DEPLOY your project.

  6. September 3, 2010 at 10:57 pm

    I did ‘clean’ and ‘build’ a hundred times trying different namespace/type configurations thinking there was a bug in my code… then i found your blog =)

    Generating a new key worked for me too! Thanks a ton!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: