Failed to locate assembly error on serialization (1 Viewer)

d-fader

Portal Pro
September 24, 2006
70
25
44
I live in Purmerend, a small town just above Amst
Home Country
Netherlands Netherlands
Hi people,

I'm working on an improvement of the Global Search plug-in, but I got stuck on the serialization part of the configuration. I'm trying to read and write it to a file on disk, but it doesn't work. Searching this forum, I found the following thread which describes the *precise* problem I have. The last message in the thread states that the original poster should cross-check it with another post, but when I click that, I come to a page in German that has nothing to do with serialization (I think).

Here's the original thread: https://forum.team-mediaportal.com/plugins-47/error-failed-locate-assembly-560/.

Here's the code I try to execute which fails:

Code:
        public bool LoadFromFile(string filename)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(GlobalSearchSettings));
                TextReader reader = new StreamReader(filename);
                [b]globalSearchSettings = (GlobalSearchSettings)serializer.Deserialize(reader);[/b]
                reader.Close();
                return true;

            }
            catch (Exception e)
            {
                return false;
            }
        }

Here's the error message I get when this is executed (the bold line triggers the error):
GlobalSearchSettings_LoadError.gif



My questions:

1. Can someone help me getting this to work?
2. If not, can someone check if the 'cross-check' link is correct and if so, what it means?
3. Why the heck DOES this work when I run it in a normal Windows Application (!!!!) ?


:D


grtz,
d-fader

Hmm, I built GlobalSearch with the SVN tag for version 1.0 RC2 and now it seems to work. I used to build with some trunk version of 0.2.3, can anyone tell me what was wrong with that version? thnx.
 

d-fader

Portal Pro
September 24, 2006
70
25
44
I live in Purmerend, a small town just above Amst
Home Country
Netherlands Netherlands
More info about this problem.

Okay, the problem still exists, but it has something to do with the Configuration.exe application trying to load the GUIGlobalSearch.dll again (!?) when the serialization kicks in. When I put a copy of the DLL in the same directory as Configuration.exe, it works, but when it's in .\plugins\windows it doesn't work.

Does anyone ever had *ANY* experience with this!?
 

moiristo

Portal Pro
November 17, 2006
342
27
Enschede
Home Country
Netherlands Netherlands
After doing a search on the forum, it seems that the error has occurred before. Here is mentioned that it can happen when you mix up DLL versions. Have you referenced the same GlobalSearch dll in your project as the one you are using when running MP?
 

d-fader

Portal Pro
September 24, 2006
70
25
44
I live in Purmerend, a small town just above Amst
Home Country
Netherlands Netherlands
Have you referenced the same GlobalSearch dll in your project as the one you are using when running MP?

I think so, actually the GlobalSearch dll is the project :)
I managed to work my way around the problem by using the 'MediaPortal.Profile.Settings' class. Although it works now, I think it would've been better when serializing objects wasn't a problem, but that aside.

Luckily I have something working at the moment :). Expect a new version quite soon ;).
 

Users who are viewing this thread

Top Bottom