Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Interesting NullReferenceException Error VB.NET - Windows Service

Posted on 2004-10-05
2
Medium Priority
?
280 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 375 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

972 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