Null reference exception when reading the datarow from .xml file

May 24, 2012 at 7:16 AM

I am using Souce code version 16181 and CUITe 1.05 Setup

Hashtable ht = CUITe.CUITe_DataManager.GetDataRow(Type.GetType("EPAutomation.SignInTest"), "Testconfig.xml", "EASignIn");

Error message:

Test method EPAutomation.SignInTest.SignInTestMethod threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.

Stack Trace :

System.Xml.XmlReader.CalcBufferSize(Stream input)
System.Xml.XmlTextReaderImpl.InitStreamInput(Uri baseUri, String baseUriStr, Stream stream, Byte[] bytes, Int32 byteCount, Encoding encoding)
System.Xml.XmlTextReaderImpl..ctor(String url, Stream input, XmlNameTable nt)
System.Xml.XmlTextReader..ctor(Stream input)
CUITe.CUITe_DataManager.GetXmlTextReader(Assembly _assembly, Type type, String sFileName) in C:\cuite-16181\CUITe\CUITe_DataManager.cs: line 17
CUITe.CUITe_DataManager.GetDataRow(Assembly _assembly, Type type, String sFileName, String sDataRowId, Hashtable ht) in C:\cuite-16181\CUITe\CUITe_DataManager.cs: line 22
CUITe.CUITe_DataManager.GetDataRow(Type type, String sFileName, String sDataRowId) in C:\cuite-16181\CUITe\CUITe_DataManager.cs: line 80
EPAutomation.SignInTest.SignInTestMethod() in C:\tfs\someproject\Trunk\Portal.Test\SignInTest.cs: line 70

Appreciate your help


May 24, 2012 at 7:27 AM

The xml file has to be included in the project with a "Build Action" of "Embedded Resource".

May 24, 2012 at 3:29 PM
Thank you for quick response. Do you have documentation for "Build Action" of "Embedded Resource".? I would really appreciate. Thanks!

On Wed, May 23, 2012 at 11:27 PM, icnocop <> wrote:

From: icnocop

The xml file has to be included in the project with a "Build Action" of "Embedded Resource".

Read the full discussion online.

To add a post to this discussion, reply to this email (

To start a new discussion for this project, email

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at

Sailaja Nalamati
May 24, 2012 at 7:22 PM

File Properties



1. Right-click on the xml file and select Properties.

2. Set the "Build Action" to "Embedded Resource".

Jun 27, 2012 at 8:18 PM



My ValidateAccountsOfSO.xml files reside in TestData folder. I set the BuildAction of it to Embedded Resource.

I have mentioned on the top of my test class as



public class DisplayServiceOrderTests : PortalBaseTest

And I am trying to access it with below code


public void ValidateAccountDetailsOfSO_AgreementAdminTest()


Hashtable soDetails = CUITe_DataManager.GetDataRow(Type.GetType("Portal.Test.Int.DisplayServiceOrderTests"), "ValidateAccountsOfSO.xml", "ServiceOrderDetails");


I get the same null reference exception. If I move the above xml to the project folder I don’t see this exception.

What do I need to do to organize test xml files and invoke from the code?


Sindhura Nadepalli.

Jun 28, 2012 at 8:38 AM

Hi Sindhura,

You will need to specify the folder name\hierarchy in the sFileName parameter.

In your case,

Hashtable soDetails = CUITe_DataManager.GetDataRow(Type.GetType("Portal.Test.Int.DisplayServiceOrderTests"), "TestData.ValidateAccountsOfSO.xml", "ServiceOrderDetails");

See this posts for reference: