Assembly Initialization method :System.NullReferenceException: System.NullReferenceException

Hi All,

I have a Team Project with various Test cases in it. When I try to run these test cases I am getting the following error:

Assembly Initialization method PcsFwTestProject.AssemblyTestLoad.MyAssemblyInitialize threw exception. System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object.. Aborting test execution.

I am getting this error at this piece of code in my program:

#region Additional test attributes

[AssemblyInitialize()]

publicstaticvoid MyAssemblyInitialize(TestContext testContext)

{

AppDomain ad =AppDomain.CurrentDomain;//.AppendPrivatePath =

try

{

ServiceManager.Services.AddService(newMessageService());

ServiceManager.Services.AddService(newResourceService());

ServiceManager.Services.AddService(newIconService());

ServiceManager.Services.InitializeServicesSubsystem("/Workspace/Services");

}

catch (Exception e){

throw e;}

}

#endregion

Can someone suggest why I am getting this error? Am I missing some dll or initialization of some variable? I appreciate a response in this regard.

Thanks

[2658 byte] By [KavyaKonda] at [2007-12-22]
# 1

Hello,

If you can compile your code with no errors, you're definitely not missing a dll.
NullReference exception can occur when you try to access a property of an object that has not been instantiated, or that has been set to null. I suggest that you debug your code to see exactly what the problem is.

Thanks,
David Gorena Elizondo
[MSFT] VSTS

DavidGorenaElizondo-MSFT at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...

Visual Studio Team System

Site Classified