Solved

Interesting NullReferenceException Error VB.NET - Windows Service

Posted on 2004-10-05
2
272 Views
Last Modified: 2008-02-01
Hello,

I'm wiritng a service, and when attempting to start the service (after installing using installutil) I receive this is the Application Log:

Service cannot be started. System.NullReferenceException: Object reference not set to an instance of an object.
   at PxpParser.PxpParser.StartWatch() in C:\Visual Studio Projects\PxpParser\PxpParser.vb:line 135
   at PxpParser.PxpParser.OnStart(String[] args) in C:\Visual Studio Projects\PxpParser\PxpParser.vb:line 363
   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)



Funny thing is my Line 135 reads like this:
watcher.Path = dump

AND dump is defined earlier (outside of the funciton that line 135 is in) on line 29 as:
 Public dump As String = "c:\cytodata\dump"


AND My line 363 is just the StartWatch() in:
 Protected Overrides Sub OnStart(ByVal args() As String)
              StartWatch()
    End Sub


So What the HECK is going on! I don't get it...This service should be starting up and I am pulling my hair out. I need some direction please. Thanks in advance!!

-- croag


0
Comment
Question by:croag
2 Comments
 
LVL 4

Accepted Solution

by:
VIkasumit earned 125 total points
ID: 12234314
Hi..

Check the Defination of watcher

If it not intialize with new keyword it is not going to accept the value.

And give a little bit more code around if that doesn't solve your problem

VIkasumit
http://www.sumitgupta.5gigs.com
0
 
LVL 1

Author Comment

by:croag
ID: 12240591
i see what you mean. I actually need to have this project done soon. I have posted it on rentacoder.com for a couple of $$. Check it out if you would like to.  

http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=197044

Thanks,

Croag
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now