Error Generating Documentation

Oct 23, 2007 at 10:49 AM
I get the "there was an error generating the XML document" error under certain occasions. After debugging the application I foung out that the Load method in Host.cs was causing the problem. The GetInstance was returning null and the wmiHost.Properties collection call was returning the error Object Reference Not Set blah blah. Modified code that works is below:

internal void Load(BizTalkCore.BtsCatalogExplorer explorer, BizTalkCore.Host host)
{
TraceManager.SmartTrace.TraceIn(explorer, host);

this.defaultHost = host.IsDefault;
this.groupName = host.NTGroupName;

ManagementObject wmiHost = this.GetInstance(ConfigClassName);
if (wmiHost != null)
{
int hostType = Convert.ToInt32(wmiHost.Properties"HostType".Value.ToString());
this.inprocess = hostType == 1 ? true : false;
this.isolated = hostType == 2 ? true : false;

this.authTrusted = (bool)wmiHost.Properties"AuthTrusted".Value;
this.hostTrackingEnabled = (bool)wmiHost.Properties"HostTracking".Value;

try
{
string q = "SELECT * FROM MSBTS_HostInstanceSetting WHERE HostName = \"" + this.Name + "\"";
ManagementObjectSearcher mos = new ManagementObjectSearcher("root\\MicrosoftBizTalkServer", q);

foreach (ManagementObject oReturn in mos.Get())
{
HostInstance hi = new HostInstance();
hi.Name = oReturn"RunningServer".ToString();
hi.Logon = oReturn"Logon".ToString();
hi.Disabled = Convert.ToBoolean(oReturn"IsDisabled".ToString());

this.hostInstances.Add(hi);
}
}
catch (Exception ex)
{
TraceManager.SmartTrace.TraceError(ex);
}

TraceManager.SmartTrace.TraceOut();
}
}