Object reference not set to an instance - Webpart Sharepoint

When you download and install  the Visual Studio 2005 Extensions for WSS3.0.
You could have taught wow my deployment stress is over
But actually it isn't  its just the start

I had deployed several webparts to my sharepoint sites without getting the error 

Object reference not set to an instance

But after sometime these ugly errors started popping up .

One was
Object reference not set to an instance the other was some GUID error


After pulling out my hair i didn't have i found an individual who shed a light on it here at   WSSWIKI

He even add a missing feature application you can download.But when i tried running the application
i get error it can't access the database

Later i found this solution below :-

PROBLEM:

========

Deploying webpart to SharePoint 2007 using  Visual Studio Extensions for Windows SharePoint Services (VSE WSS) and getting error message “Object reference not set to an instance of an object”.

 

RESOLUTION:

===========

1] Copy the built webpart.dll to c:\windows\assembly (GAC)

 

2]  In the folder location where webpart VSE solution was created found setup.bat file in bin\Debug, and this is the file which VSE calls when deploying the solution and has instructions to run it. Ran the setup.bat from command prompt as “setup /uninstall” this ran ok, then ran setup /install this ran ok too. Modified the setup.bat file and add the line to remove the webpart.dll from the GAC and add the webpart.dll assembly to GAC as under:

 

under :LDeploy section before goto :EOF added the following line:

===========================================================

"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if webpartTest.dll

"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -uf webpartTest

iisreset

**Make sure you changed the name of your webpart to the one in question

This solved my problem but sometimes it did work sometimes it didn't and  the solution need a lost of manual process.

Al last i came across this featurecleaner Utility
And it did the TRICK it actually fixes it and deletes orphaned features from the feature table.

Hope the next VseWSS ver 1.2 will be out soon

Enjoy

Print | posted on Tuesday, April 22, 2008 9:00 PM

Feedback

# re: Object reference not set to an instance - Webpart Sharepoint

Left by Stark Botha at 5/28/2008 10:08 AM
Gravatar Thanks mate! This helps a lot!

# re: Object reference not set to an instance - Webpart Sharepoint

Left by Thiago Bortot R. Chagas at 8/8/2008 9:24 AM
Gravatar Thanks a lot for your post! It was very helpful!

I've had the same problem on deploying any solution into sharepoint (webparts, custom fields, etc).

I just want to share what I did to get it working:

- I retracted and undeployed the solution I was working on;
- then, I ran the Featurecleaner Utility finding 2 orphan features. I erased them.
- Finally, I deployed the solution successfully.

I hope this is useful for someone as the first post was for me.


Thank you.

# re: Object reference not set to an instance - Webpart Sharepoint

Left by hamid at 8/10/2008 11:46 PM
Gravatar Server Error in '/WebApplication2' Application.
--------------------------------------------------------------------------------

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 36: Dim picinfo As FileInfo
Line 37: Dim picpath As String
Line 38: Dim pichttp As HttpPostedFile = Request.Files("file1")
Line 39: If (pichttp.FileName).ToString <> "" Then
Line 40: picinfo = New FileInfo(pichttp.FileName)


Source File: C:\Inetpub\wwwroot\WebApplication2\WebForm1.aspx.vb Line: 38

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
WebApplication2.WebForm1.Button1_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\WebApplication2\WebForm1.aspx.vb:38
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

# re: Object reference not set to an instance - Webpart Sharepoint

Left by web development company at 8/17/2009 11:25 AM
Gravatar Thanks a lot ,
I have got use to the fact that when microsoft makes a solution for a problem it makes an other problem, any way

Keep up the good work

# re: Object reference not set to an instance - Webpart Sharepoint

Left by girish kolte at 4/17/2010 7:43 AM
Gravatar i m getting the same error , and yet not find any solution...

# re: Object reference not set to an instance - Webpart Sharepoint

Left by Rodolfo at 5/6/2010 12:27 PM
Gravatar Excelente, gracias me haz salvado la vida, jajajaja

# re: Object reference not set to an instance - Webpart Sharepoint

Left by Roli at 5/13/2010 7:25 AM
Gravatar Hi

I had the same error message. I generated a solution with SPSolGen.exe V1.3 and modified the ONET.xml:

<Modules>
<!--
<Module Name="Home" />
-->
</Modules>

With the "Package" command i got the error message "Object reference not set to an instance".
I removed the commented lines:

<Modules>
</Modules>

Now i could package the Solution without problems. It looks that comments in xml files are not possible.

Greetings,
Roli

# re: Object reference not set to an instance - Webpart Sharepoint

Left by ramesh at 7/1/2010 3:55 AM
Gravatar error : Object reference not set to an instance of an object.sorry idid not get it
please explain step by step

Your comment:





 

Copyright © Patrick.O. Ige

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski