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

posted @ Tuesday, April 22, 2008 9:00 PM

Print

Comments on this entry:

# 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

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345