Click here to Skip to main content
15,886,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi there,

I am using a library for communication to a PLC.
Today it out of nowhere "crashed" with the following error:
There is an eror in XML-docoment (0, 0). Rootelement is missing


I know that its the rootelement that is missing in a XML-file, but the problem is its a library with .dll's that gives the error. There is no XML-file, and it happens on all the other applications I have written as well even though they are different application, and each application use different .dll's.
I have tried replace the .dll's with some new, and that doesnt work neither.

But, if I am running my application on another computer it is working very well and no exceptions is coming.

So I am wondering, is this a fault at my computer or some C# code I have done wrong?
What can I eventually do to fix it?

Thanks for your time,
and have a nice weekend.
Posted
Comments
Member 4417892 11-Nov-11 6:02am    
The code is as follows:

using System.Text;
using System.Windows.Forms;
using DotNetSiemensPLCToolBoxLibrary;
using DotNetSiemensPLCToolBoxLibrary.Communication;
using DotNetSiemensPLCToolBoxLibrary.Communication.Library;
using DotNetSiemensPLCToolBoxLibrary.Communication.Library.Interfaces;
using DotNetSiemensPLCToolBoxLibrary.Communication.Library.Pdus;
using DotNetSiemensPLCToolBoxLibrary.DataTypes.Blocks.Step7V5;
using DotNetSiemensPLCToolBoxLibrary.PLCs.S7_xxx;
public bool Connect(string ip, int port, int rack, int slot)
{
try
{
// Thread.Sleep(2000); //Sleeps otherwise it wont connect sometimes
PLCConnectionConfiguration conf = new PLCConnectionConfiguration(); ;

conf.ConfigurationType = LibNodaveConnectionConfigurationType.RegistrySavedConfiguration;


myConn = new PLCConnection("FHA");
myConn.Connect();

return true;
}
catch (Exception e)
{
Error = e.Message;
return false;
}
}
The error comes when I am calling the Connect method in myConn.
As you see I aint touching much of XML, but I am pretty sure the error happens within the .dll where it probably uses some sort of XML for something I dont know.

 
Share this answer
 
Comments
Member 4417892 11-Nov-11 5:41am    
I am not even reading or writing any XML, the library dll seems to cause the error when I call it functions.

I have read the whole forum thread, and also tried to see if I could implement it in my code, and I am pretty sure I can't handle it that way.
Member 4417892 11-Nov-11 5:46am    
This is where I get the error:
PLCConnection myConn = new PLCConnection("Con");
myConn.Connect();
thatraja 11-Nov-11 5:51am    
Please include your full code in your question
Member 4417892 11-Nov-11 7:07am    
Just did :)
Had to use Reflector to decompile the dll file and find the directory to the .XML file and then change it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900