Throws Null exception when I try to use DataManager


I want to utilize DataManager functionality provided by CUITE but it throws Null exception at

Hashtable htdata = CUITe_DataManager.GetDataRow(Type.GetType("SampleTestProject.UnitTest1",true,true), "XMLFile1", "tc2");

Am I doing anything wrong?

I have added XMLFile in project but still the same issue. Help needed

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;
using CUITe;
using System.Collections;
using SampleTestProject.ObjectRepository;
using CUITe.Controls.HtmlControls;

namespace SampleTestProject
public class UnitTest1
    //Hashtable htData = CUITe_DataManager.GetDataRow(Type.GetType("SampleTestProject.UnitTest1"),"XMLFile1.xml","tc2");
    public void TestMethod1()
        Hashtable htdata = CUITe_DataManager.GetDataRow(Type.GetType("SampleTestProject.UnitTest1",true,true), "XMLFile1", "tc2");
        CodePlex pgCodePlex = CUITe_BrowserWindow.GetBrowserWindow<CodePlex>();




icnocop wrote Feb 27, 2013 at 4:13 PM


Is the xml file marked as an "Embedded Resource"?

Can you paste the complete stack trace and point out the line number in your code please?

Thank you.

amjadkhan_infy wrote Feb 28, 2013 at 8:07 AM

at System.Xml.XmlReader.CalcBufferSize(Stream input)
at System.Xml.XmlTextReaderImpl.InitStreamInput(Uri baseUri, String baseUriStr, Stream stream, Byte[] bytes, Int32 byteCount, Encoding encoding)
at System.Xml.XmlTextReaderImpl..ctor(String url, Stream input, XmlNameTable nt)
at System.Xml.XmlTextReader..ctor(Stream input)
at CUITe.CUITe_DataManager.GetXmlTextReader(Assembly _assembly, Type type, String sFileName) in E:\CUITe\CUITe\CUITe_DataManager.cs:line 17
at CUITe.CUITe_DataManager.GetDataRow(Assembly _assembly, Type type, String sFileName, String sDataRowId, Hashtable ht) in E:\CUITe\CUITe\CUITe_DataManager.cs:line 22
at CUITe.CUITe_DataManager.GetDataRow(Type type, String sFileName, String sDataRowId) in E:\CUITe\CUITe\CUITe_DataManager.cs:line 80
at SampleTestProject.UnitTest1.TestMethod1() in c:\users\v-amkhan\documents\visual studio 2010\Projects\SampleTestProject\SampleTestProject\UnitTest1.cs:line 25

I dont have E:\ drive on my system. I dont know from where its taking the E:\CUITe\CUITe\CUITe_DataManager.cs

amjadkhan_infy wrote Feb 28, 2013 at 8:11 AM

Yeah I have XML as embeded resource in properties Window.

Error is thrown at
Hashtable htdata = CUITe_DataManager.GetDataRow(Type.GetType("SampleTestProject.UnitTest1",true,true), "XMLFile1", "tc2");

amjadkhan_infy wrote Feb 28, 2013 at 8:17 AM

[External Code] 
CUITe.dll!CUITe.CUITe_DataManager.GetXmlTextReader(System.Reflection.Assembly _assembly, System.Type type, string sFileName) Line 17 + 0x2c bytes   C#
CUITe.dll!CUITe.CUITe_DataManager.GetDataRow(System.Reflection.Assembly _assembly, System.Type type, string sFileName, string sDataRowId, System.Collections.Hashtable ht) Line 22 + 0xf bytes  C#
CUITe.dll!CUITe.CUITe_DataManager.GetDataRow(System.Type type, string sFileName, string sDataRowId) Line 80 + 0x2a bytes    C#
SampleTestProject.dll!SampleTestProject.UnitTest1.TestMethod1() Line 25 + 0x2a bytes C#
[External Code] 

icnocop wrote Feb 28, 2013 at 9:35 AM

Please make sure you use the complete file name with the file extension.
Hashtable htdata = CUITe_DataManager.GetDataRow(Type.GetType("SampleTestProject.UnitTest1",true,true), "XMLFile1.xml", "tc2");
Otherwise you will get a NullReferenceException as you experienced.

E:\ indicates the file path the CUITe source code at the time it was compiled of the version you are using.

Thank you.

icnocop wrote Mar 18, 2013 at 1:51 AM

With changeset 24881, CUITe uses a new ResourceNotFoundException in this case.