Solved

Interesting NullReferenceException Error VB.NET - Windows Service

Posted on 2004-10-05
2
275 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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