Problem with XmlNode.ChildNodes across different machines

I'm having the darndest XML config file problem that I really need help with.  

I'm supporting a .NET 1.1 desktop application with its own config file, and 
I implement IConfigurationSectionHandler so I can have a custom config 
section in my config file.  The IConfigurationSectionHandler.Create method 
just returns the 'section' XmlNode back to the consumer.  The config file 
looks kind of like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MyConfigSettings" type="MyAssembly.ConfigReader, MyAssembly" />
</configSections>
<appSettings>
</appSettings>
<MyConfigSettings>
<ConfigSet zone="Test">
<add key="FirstKey" value="FirstValue"/>
<add key="SecondKey" value="SecondValue"/>
<add key="ThirdKey" value="ThirdValue"/>
</ConfigSet>
<ConfigSet zone="Integration">
<add key="FirstKey" value="FirstValue"/>
<add key="SecondKey" value="SecondValue"/>
<add key="ThirdKey" value="ThirdValue"/>
</ConfigSet>
</MyConfigSettings>
</configuration>


Then I've got this section of code that looks like this:


    Public Shared Sub SetConfigZone(ByVal Zone As String)

        Dim debug As String

        Try
            debug &= "Checking Zone variable " & Environment.NewLine

            If (Zone Is Nothing) Then
                MessageBox.Show("Zone variable passed in is nothing")
            End If

            debug &= "Getting XmlNode from config file " & Environment.NewLine
            Dim parent As XmlNode = 
ConfigurationSettings.GetConfig("MyConfigSettings")

            debug &= "Checking parent variable " & Environment.NewLine
            If (parent Is Nothing) Then
                Throw New ConfigurationException("Unable to locate the 
custom configuration section MyConfigSettings.  Please check your config 
file.")
            End If

            MessageBox.Show(parent.OuterXml)

            debug &= "Beginning loop through nodes " & Environment.NewLine
            For Each node As XmlNode In parent.ChildNodes
                MessageBox.Show(node.OuterXml)
                debug &= "Inspecting Node's zone attribute... " & 
Environment.NewLine
                If (node.Attributes("zone").Value = Zone) Then
                    debug &= "Correct node found... " & Environment.NewLine
                    debug &= "Creating new NameValueCollection... " & 
Environment.NewLine
                    ConfigCommon.m_ConfigSettings = New NameValueCollection
                    debug &= "Looping through 'add' subnodes... " & 
Environment.NewLine
                    For Each subNode As XmlNode In node.SelectNodes("add")
                        debug &= "Getting subnode's 'key' value... " & 
Environment.NewLine
                        
ConfigCommon.m_ConfigSettings.Add(subNode.Attributes("key").Value, 
subNode.Attributes("value").Value)
                    Next
                    Return
                End If
            Next
        Catch ex As Exception
            MessageBox.Show(debug, "Our debug message")
            MessageBox.Show(ex.ToString(), "Our error message")
        End Try

        'If we get this far, we haven't found our configuration section
        Throw New ConfigurationException("Unable to locate configuration 
zone " & Zone)

    End Sub

So here's my problem.  This code has been working just great for the last 
six to nine months, but all of a sudden about two weeks ago all of the new 
machine builds our desktop group puts out fail at the following line:

                If (node.Attributes("zone").Value = Zone) //fails on first 
run through

On new machines, it's producing a NullReferenceException.  But when I take 
the exact same code and run it on anyone else's machine, it works just fine.  
In fact, you'll notice that I added a lot of little debugs and 
MessageBox.Show statements in there to try to pinpoint it.  When I run the 
code on my machine, I notice that the MessageBox.Show(node.OuterXml) produces 
the first node.  When I run this on a newly built machine, the 
MessageBox.Show produces an empty string.  

My question is:  what is missing from these new builds that was in the old 
builds?  I think I've ruled out different versions of the .NET framework.  
Even if this was a breaking change in .NET 2.0, I tried forcing the .NET 
Framework in the config file to 1.1 and still got the same error.  And the 
users definitely have the .NET 1.1 Framework.  

Please help.  

Thanks.

0
3/14/2007 9:42:03 PM
dotnet.xml 7266 articles. 0 followers. Follow

5 Replies
526 Views

Similar Articles

[PageSpeed] 44

Hi,

In fact, I have run the application with your code and .config file on my 
machine (with .net framework 2.0), but without any error. The code snippet 
you posted in newsgroup is fine.

> When I run the code on my machine, I notice that the 
MessageBox.Show(node.OuterXml) >produces the first node.  When I run this 
on a newly built machine, the MessageBox.Show produces an empty string.  

Is there any output by  "MessageBox.Show(parent.OuterXml)" ?
I suggest you may output the parent.Attributes.count and through out each 
Attribute of parent node rather than only output the attribute "zone". 
There must be something wrong in Parent.Attributes.

Hope this helps,
Sincerely,
Wen Yuan

0
v-wywang (104)
3/15/2007 1:49:28 PM
Hi Wen Yuan,

> Is there any output by  "MessageBox.Show(parent.OuterXml)" ?

On both the old and new builds, the parent.OuterXml displays just fine.  

This app is written in .NET 1.1 and the users have the .NET 1.1 Framework on 
their machines.  Does this code run just fine for you in .NET 1.1?  

0
3/15/2007 2:00:10 PM
Hello,
Thanks for your reply.

I uninstalled my .net framework 2.0 and installed .net framework 1.1 just 
now. This is really a bug. I have reproduced this issue. The node.outXml 
become null and I get the same exception as you.
But after I installed sp1 for .net frame work 1.1. The issue has gone away.
Apparently, this issue has been addressed in SP1 and .net framework 2.0. 
(under my test).
For this reason, I suggest you may installed sp1 for .net 1.1 or installed 
new .net 2.0 to resolved this issue.
You can download sp1 for .net 1.1 from the following website.
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=A8F5
654F-088E-40B2-BBDB-A83353618B38
[Microsoft .NET Framework 1.1 Service Pack 1]

Hope this will hope you. Also if you have any further issue, please feel 
free to let me know. I'm glad to assist you.
Have a great weekend.
Sincerely,
Wen Yuan

0
v-wywang (104)
3/16/2007 11:30:59 AM
Wen Yuan,

Thank you very much for your help.  Independently yesterday I stumbled 
across this article which outlines my issue:

http://support.microsoft.com/kb/823054

As you indicated, it is a bug having do with Config files represented as 
XML.  I am working with our Desktop team to determine which patch installed 
in the last few months fixed it, as I don't believe we are running SP1 but 
have applied numerous patches from 1.1.  Converting to .NET 2.0 is not an 
option for us, as it would require much more thorough testing of our 
application.  

Thanks again for your help.  

0
3/16/2007 1:12:06 PM
Thanks for your feedback. You are welcome.:)
As you see, I think .NET 1.1 SP 1 will resolve the issue for you.

Have a great day,
Sincerely,
Wen Yuan

0
v-wywang (104)
3/19/2007 7:04:09 AM
Reply:

Similar Artilces:

encoding problem in Outlook 2007 importing Outlook 2000 personal folders
I use Outlook 2007 to import the pst file of Outlook 2000. The Chinese characters in the subject became unreadable but it's ok to display in message body. In Outlook 2000, there's no problem to display the Chinese characters in the subject. What's wrong with Outlook 2007? What setttings should I change to fix the problem? Thanks. cyl <u8526505@gmail.com> wrote: > I use Outlook 2007 to import the pst file of Outlook 2000. The Chinese > characters in the subject became unreadable but it's ok to display in > message body. In Outlook 2000, there's no problem t...

Problem shortcuts in Word
Hello, I work with Word 2008. In the beginning there is no problem, but suddenly i have problem with shortcuts. When i want to do "cmd c" it make an other shortcuts same thing for "cmd s", "cmd v" and surly some other. But when i write there is no problem "c" is "c"... If somebody have an idea please help me. Thank you. Unless you indicate your specific update level of Office as well as OS X & describe what the keystrokes *are* doing contrary to what you expect there isn't much we can offer. -- Regards |:>)...

Outlook 2003 PST problems
I just installed Office 2003 professional on a new computer & am having problems with outlook. I copied my Outlook.pst file into the appropriate directory & although it is recognized the calendar is not working properly. I cannot attach any of the colored labels to my appointments - so everything is pretty much in black & white. I totally uninstalled & reinstalled office... first removing my pst file... but there appears to be an ini file... or something that is retaining some information... does anyone know of a fix for the labels... or how to TOTALLY uninstall office (so I...

Problem with Authentication
The CRM application was running smooth. But now I can't logging. It ask my credentials and than return a 401.1 error. I had already reinstalled the CRM server but it won't work. I'm accessing it in the same local network. I'm running CRM 3.0 in SBS. Best regards, Erico Hi When you open a Internet explorer and type the name of the CRM server, it prompts for user and password ? Are you logged in with domain credentials ( AD user ) ? If you are, so add url of the crm server in Local intranet. Enable "Automatic logon only in intranet", this is under security,c...

Vista blue screen problem...please help!
I've seen some other threads, here are the dump files: 'RapidShare: 1-CLICK Web hosting - Easy Filehosting' (http://rapidshare.com/files/347103149/Minidump.rar.html) Please, help me out here. -- ceVil It might be better to know at what point the bsod occurs and what the actual err.msg given is "ceVil" <guest@unknown-email.com> wrote in message news:0b9a0c60b90bf6c0be88bda30f2820ab@nntp-gateway.com... > > I've seen some other threads, here are the dump files: > 'RapidShare: 1-CLICK Web hosting - Easy Filehosting' > (...

calendar problem
Dear all, I am using both mail and calendar function in outlook 2002. Everything is ok until recently, when I try to make a new appointment or checking any old appointments, an error message "out of memory or resource, try to close some windows..." pop up. The mail function is still ok. Can anyone tell me how can I solve this? I have already installed sp2. The version of office is the professional one with frontpage. Thanks. tp ...

problem #4
Hi, I am facing this new problem... i.e a user has installed Office 2003 on win2k prof platform.. whenever she is working on a outlook.. she gets a Microsoft error message... saying to send the report or don't send the report... Usually I have seen this problem in IE... But for outlook it is new to me... after clicking on send or don't send report.. the outlook closes. And there are no IE open..... and if atall it is open.. the IE does not close... Need your help regards, KAH What is logged to the Event Viewer regarding this? Try one of the following already; http://www.howt...

95 and 97 problem
For some unknown reason there is Excel 95 and 97 on this pc.When i double click on an Excel file, the pc defaults to the 95 program (Which incidently doesn't work properly). So my question is how do i get the pc to default to 97. Cheers Craig Craig, Have a look at Windows Help. From Windows 2000 Help (Index under Programs Associating with File Types) To change which program starts when you open a file In My Computer or Windows Explorer, on the View menu, click Folder Options. Click the File Types tab. In the list of file types, click the one you want to change. Click Edit. In Act...

sync problems
I have all of my info on an HP Ipac. I had to reformat the hard drive and I did not make a back-up file. I am trying to move everything back to the computer but it says there is an error with syncing it. How can I move everything from the PDA back to Outlook again? Please help- thanks ...

Date problem
I can't believe there's no post on this, but I can't find it. I've tried the solutions I could find (see below) and still get the error: "The expression is typed incorrectly or it is too complex to be evaluated. For example....Try simplifying...." I have a date field, formatted as Date/Time, General Date, default Value = Now(). I like having the date and the time - in case we need it. I want to run a report on calls taken just for one day. I have CallDate: CallDateAndTime in my query, with "criteria" as Between ([Forms]![frmReports]![txtStartDate]) A...

Installation Problem!!
I am having a problem installing MSCRM 1.2. My configuration consists of a Domain Controller running Win 2000 Server SP4 . I am trying to install MSCRM on a member of the domain running Windows 2000 Server SP4. There is a DNS Server on the DC which is integrated with AD, and a SQL Server 2000 running on the Win 2K machine. The install errors out when CRM creates the root business with the message: Setup was unable to install Microsoft CRM Server. Setup was unable to provision your organization. Setup was unable to create the root business. The configuration of ASP.NET seems to be ok, the pr...

Office 2007 - HELP
I have used Word for many years and love it - not too thrilled with the changes in Office 2007, but my bigger issue is with Publisher 2007. I have an image that I have used in Word just fine - meaning, the on screen colors are correct and when printed the colors are correct. Someone sent me a Publisher file and asked me to add the image - I did this - now the image is messed up - the colors are correct on screen, but when printed FROM MY computer the image colors are all wrong - but if I transport the file to a different computer it prints fine I have reinstalled Office - no good Any id...

Resource editor problems
Hello all, Under VC++ 7.1... Please consider these two lines: IDC_ARROW_ADD_CANCEL DISCARDABLE "res\\cur00004.cur" IDC_ARROW_ADD_CANCEL CURSOR DISCARDABLE "res\\cur00004.cur" The second is a hand-edited change to the first. Both will compile just fine in the resource compiler. However, after I use a text editor to make this change, I cannot open the .rc file in the resource editor. The resource editor issues the following error open attempting to open the .rc file: error RC2135 : file not found: CURSOR Can anyone shed light on what's going on here? Thanks, Dave ...

Directory Replication Problem #2
Hi, recently my Exchange Server directory database receives changes from other servers but does not send out its own changes. Check from the knowledge base, to correct the USN discrepancy need to use Authrest.exe (need to amke changes for about 100+ users). Does anybody know where to get this file 'Authrest.exe' for exchange server 5.5? Exchange server 5.5 CD only provide this file for ver.4.0. Have anyone use it before? Regards, "Sharon Tan" <sharon_tansk@yahoo.com.sg> wrote: >Hi, recently my Exchange Server directory database >receives changes from ot...

Problems Creating a disclaimer in Exchange 2003
I am trying to create a server based disclaimer that will stamp all of my smtp emails going to the internet. I have been following KB article 317680 with no luck. I get an error like the one below. Binding Display Name Specified: smtpscriptinghost ** Registration Failed ** Err.Number (HRESULT) = 0x1AD Err.Description = ActiveX component can't create object ProgID = cdo.ss_smtponarrival COM Category = {FF3CAA23-00B9-11d2-9DFB-00C04FA322BA} Corresponding Event = onarrival ** Have you registered your sink COM class on this machine? I am puttin...

User Defined Variables in MS query cause a problem to import data
If I use user defined variables in MS query to import data into excel sheet, the query executes but no data gets imported into the excel sheet. If I get rid of the variable the results can be imported into the Excel sheet. ...

Cell Format
I have a spreadsheet with cells that I'm trying to type the date into. I type in the date exactly like this: 09/26/03. When I hit "enter" MS Excel displays "37890" in the cell. No matter what I do I can't the cell to show: 09/26/03. I think that somehow I need to "strip" the cell of what it's original format is, but I can't figure out how. I try to use the Date option in the format cell screen but it doesn't work. Curtis I tried this and it didn't work. I also tried the "Text to columns" feature. No success. >...

outlook web access redirect problem
hi, I have been trying to redirect outlook web access (OWA) from the IIS root folder to the /exchange folder. I have followed the instructions on going into the web site and redirecting to a folder but I just get the following URL when I browse to the root of my webserver : http://webmail/exchange/exchange - it's like it's doubling up somehow. I have it set to : A redirection to a URL redirect to: /exchange client will be sent to: A directory below URL entered I just can't work it out... any ideas... cheers Baronne Which instructions did you follow? I wrote the below articl...

Can NOT install on new Win 7 machine
This is a new one for me. But for 2 days I have been trying to get Windows Live Mail to install on a new Win 7 computer. I just keep getting weird error messages. I have installed this programs many times on many computers, and never had this happen before...I get errors like these: hr:0x80040005 another time I got hr:0x80070003 . I get something similar every time. I have tried using the Microsoft Installer Uninstall cleanup Utility I have turned OFF the firewall when installing I have tried selecting only the mail or other things...it doesn't seem to matter... HELP!!! T ...

Problem after sorting
In my Excel 2007 workbook I have two sheets The "Master Names" sheet has columns: (A) First|(B) Last (C) First (B) Last (concatenated) The "Selected Names" sheet contains (A) cells which link to selected (C) First Last (concatenated) cells in the Master Names sheet. Everything links and displays fine except when I add names to the bottom of the Master Names sheet and then sort using (B) Last name column. When I do this I get a 0 (zero) in the (A) First Second cells in the Selected names sheet and other cells in this sheet have the wrong name. Obviously I am doin...

Insurance Policies in Different Currencies
How do I set up Insurance Policies in different currencies ? I am using Money 2006 Deluxe and when I create a insurance policy, it takes the base currency as the default. Appreciate any help here. Thanks "sbmd2006user" <sbmd2006user@discussions.microsoft.com> wrote in message news:A342B0FB-5352-42E4-BB4D-3F755891436E@microsoft.com... > How do I set up Insurance Policies in different currencies ? > I am using Money 2006 Deluxe and when I create a insurance policy, it > takes > the base currency as the default. Money apparently lacks the capability you're ...

IF AND problem
Need to isolate problems on 1600 rows Worksheet Row Dept Hrs. Dollars A5 120500 600 9000 A6 120600 400 8000 A7 130600 240 A8 130400 160 A9 140600 320 6400 A10 140200 100 2000 A11 140600 240 (Found out the dept has 2 leading blanks) Isolate problems on 0600 criteria pointing out when b has value and c = 0. OK if both are 0. A7 and A11 should stand out.. =IF((MID(A1,5,4)="0600")=AND(b1>=0=AND(c1>=0)),"NO","ok") Does this work for you: =IF(RIGHT(A...

Problem SHAppBarMessage
Hi, I am creating an application bar which shall be displayed always at the top of the screen to show the user certain alerts. I am using the commands SHAppBarMessage(ABM_NEW, &abd); SHAppBarMessage(ABM_QUERYPOS, &abd); SHAppBarMessage(ABM_SETPOS, &abd); SetWindowPos(NULL, abd.rc.left, abd.rc.top, abd.rc.right - abd.rc.left, iClientHeight, SWP_NOACTIVATE); Works fine. The problem begins, when I start moving the taskbar. I am catching the event OnSettingChange and my application bar is resizing/moving correctly. BUT: If the taskbar moves to the top and my application bar ...

Lookup() problem
I set up two lists, 200 employees names and 200 employee numbers. A couple of the numbers match the correct names but the rest of the numbers all pull the same employee name. =LOOKUP(C4,List!C4:C204,List!B4:B204) The first time I tried it seemed to pull the correct matching names and numbers then kabui it gets stuck. I tried deleting the entire lists cells and all and starting over but same thing. Anyone ever run into this before? Wayman Don't forget! When using Lookup(), the vector (second argument) must be sorted in ascending order. If it's not, you'll get what you ca...

Transferring toolbars and macros to other machines
Hello How do you transfer macros and toolbars from one machine to another? If I copy "personal.xls" to another machine, it'll overwrite everything there. MS Word has "Organizer" that makes this easy but Excel doesn't have that feature. Thanks in advance. Well, you can rename personal to personal1, open BOTH files, then go into the VB Editor (Alt+F11) and click and drag modules down into the other file. Make sure you hit your save diskette when you're done. The toolbar is a bit different. It's *.xlb where the * is your username. ************ Anne Troy...