﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » XMLBasic error in testing but not in application</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 16:04:21 GMT</lastBuildDate><ttl>20</ttl><item><title>XMLBasic error in testing but not in application</title><link>http://forum.strataframe.net/FindPost17444.aspx</link><description>Hi,&lt;br&gt;
I hit error below when I run it from NUnit. However, it is working fine if I run it from my windows application. Any ideas?&lt;br&gt;
&lt;br&gt;
[codesnippet]        [Test]&lt;br&gt;
        public void TestPlugInInfosBOFillAll()&lt;br&gt;
        {&lt;br&gt;
            PlugInInfosBO loPlugInInfosBO = new PlugInInfosBO();&lt;br&gt;
            loPlugInInfosBO.FillAll();&lt;br&gt;
&lt;br&gt;
            Assert.AreEqual(2, loPlugInInfosBO.Count);&lt;br&gt;
        }&lt;br&gt;
[/codesnippet]&lt;br&gt;
Error	29	TestCase 'TestPlugIn.TestPlugInInfosBOFillAll' failed: Object reference not set to an instance of an object.&lt;br&gt;
System.NullReferenceException&lt;br&gt;
Message: Object reference not set to an instance of an object.&lt;br&gt;
Source: MicroFour StrataFrame Base&lt;br&gt;
StackTrace:&lt;br&gt;
   at MicroFour.StrataFrame.Xml.XmlBasics.OpenXmlFile(String TableName, String PathAndFileName, List`1 ColumnStructure)&lt;br&gt;
   at JK.Framework.Business.XMLBusinessLayer.FillAll() in F:\Projects\JKFramework\JK Framework Business\Business\XMLBusinessLayer.cs:line 98&lt;br&gt;
   at TestPlugIn.TestPlugIn.TestPlugInInfosBOFillAll() in F:\Projects\JKFramework\Test\TestPlugIn\TestPlugIn\TestPlugIn.cs:line 135	F:\Projects\JKFramework\JK Framework Business\Business\XMLBusinessLayer.cs	98	&lt;br&gt;</description><pubDate>Sun, 29 Jun 2008 11:16:09 GMT</pubDate><dc:creator>Chan</dc:creator></item><item><title>RE: XMLBasic error in testing but not in application</title><link>http://forum.strataframe.net/FindPost17457.aspx</link><description>That makes sense.&amp;nbsp; You can use a different mecahnism to provide the version to prevent this error.&amp;nbsp; We actually have a shared class with constants for version for this type of thing so as to prevent these types of errors.&amp;nbsp; That me be an idea to prevent this from happening since there is not an entry assembly.&amp;nbsp; I am sure that if you us the executing assemby it would work, but you might still want to use a constant instead.</description><pubDate>Sun, 29 Jun 2008 11:16:09 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: XMLBasic error in testing but not in application</title><link>http://forum.strataframe.net/FindPost17453.aspx</link><description>Hi,&lt;br&gt;
I have found out the cause. It is because I called OpenXMLFile(TableName, PathAndFileName, ColumnStructure), which internally retrieve currentversion using code System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(). In unit test environment, this code always return nothing.</description><pubDate>Sun, 29 Jun 2008 03:18:56 GMT</pubDate><dc:creator>Chan</dc:creator></item><item><title>RE: XMLBasic error in testing but not in application</title><link>http://forum.strataframe.net/FindPost17450.aspx</link><description>Obviously this is going to be really hard for me to diagnose over this post.&amp;nbsp; I do not have much experience with nUnit;&amp;nbsp; however, we do use unit testing through Team Foundation...however, I do not think that we have a test setup pulling from an XML file.&amp;nbsp; So I cannot give you a 100%, "I know this works" answer.&amp;nbsp; But it does seem suspect.&amp;nbsp; The OpenXmlFile is a shared or static method...so I wonder if the AppDomain has not been properly established at the point of execution.&lt;/P&gt;&lt;P&gt;The first thing I would do is determine which object or reference is producing the NullReferenceException.&amp;nbsp; Then it might give you/us a clue as to where to look to come up with a solution.</description><pubDate>Sat, 28 Jun 2008 23:49:19 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>