DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Strange behaviour with remoting and app.config

  1. #1
    Join Date
    Nov 2003
    Posts
    46

    Strange behaviour with remoting and app.config

    I am using business objects that are built on top of Rockford Lhotka's CSLA
    Business Object framework.

    I have a simple windows application that uses the objects configured for
    remoting and the app logs on without any problems.

    I have now created a Windows Shell Namespace Extensions application in C#
    using the Renameable example from http://www.codeplex.com/namespaceextension
    (recently moved from
    http://www.gotdotnet.com/Community/U...-a18f3ad85a65).

    When I try to call my remote objects to login from this dll, I get a
    remoting error:

    "The Type System.Xml.XmlDocument in Assembly System.Xml, Version=1.0.5000.0,
    Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as
    serializable."

    My understanding is that my dll will be running in windows' Explorer.exe
    process. Can anybody help me to find out if this is what is causing the
    problem and if so how I can get around it?

    Even just helping me to find a way of debugging the dll would be useful (I
    currently need to build the application then click on the icon that appears
    in the Other section of My Computer to run the compiled version and see my
    changes running).

    Any help would be greatly appreciated.

    Thanks in advance,

    Phil

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You should be able to debug your DLL by compiling it in Debug mode, then attaching the Visual Studio debugger to the process that's loaded your code (e.g., explorer.exe). For more information, see http://msdn2.microsoft.com/en-us/lib...4z(VS.80).aspx .
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Nov 2003
    Posts
    46
    Thanks Phil,

    I will give it a go... I set up a console app and have found out where my problem appears to be occuring...

    I have the following line that gets a setting from appsettings...

    string data = ConfigurationSettings.AppSettings["PortalServer"];

    and that works fine, but when I hardcode a url string in there....

    string data = "http://localhost/RemotingTest2/dataportal.rem";

    the data variable looks identical after being set in both cases but further in the CSLA when the code tries to create a remote object I get the error regarding XmlDocument not being serializable.

    Really strange.... I have tried doing everything I can to get the hardcoded string to be a string, but this still gets the same error....

    string data = (string)@"http://localhost/RemotingTest2/dataportal.rem".ToString();

    But if I switch back to the line that pulls exactly the same string from the appsettings it works.

    Any ideas?

    Thanks,

    Phil

  4. #4
    Join Date
    Nov 2003
    Posts
    46

    remoting settings working from appsettings but not when hardcoded

    I have a dll that uses Rocky Lhotka's CSLA. The CSLA relies on some settings in an app.config for remoting but my dll is not used by one of my apps so I have no control over the app.config.

    The point where the string is set with the url of the remote object is:

    string data = ConfigurationSettings.AppSettings["PortalServer"];

    and the setting in app.config is:

    <add key="PortalServer" value="http://localhost/RemotingTest2/dataportal.rem" />

    BUT when I change the initialization of the string to be hardcoded rather than from appsettings, like this:

    string data = "http://localhost/RemotingTest2/dataportal.rem";

    I get this error at the point the code tries to create the remote object:

    "The Type System.Xml.XmlDocument in Assembly System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable."

    If I switch the line back to the original one getting the url from the appsettings, it all works again..... This is the only thing I am changing and it works every time from appsettings but never when I hardcode the string!

    I have tried escaping the string and casting it to a string etc, like this:

    string data = (string)@"http://localhost/RemotingTest2/dataportal.rem".ToString();

    and every time, the string variable looks exactly the same as setting it from the appsettings but I get the error when the url is hardcoded.

    This is a real showstopper for me, so I would really appreciate any help that anybody can give me.

    I even emailed Rocky himself but he could not think of why it could be happening.

    Thanks.

    --
    Regards,

    Phil Johnson (MCAD)

Similar Threads

  1. Replies: 1
    Last Post: 11-30-2006, 09:08 AM
  2. Modifying app.config after deployment
    By zaexception in forum .NET
    Replies: 1
    Last Post: 09-20-2006, 02:26 AM
  3. Replies: 5
    Last Post: 03-16-2006, 08:01 PM
  4. App.config not Working
    By ZafarIqbal in forum .NET
    Replies: 2
    Last Post: 10-27-2005, 08:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center