2007-10-13, 01:33 PM
Iâve come across two problems using the xmlserializer in my plugin. This first one I can work around (but donât understand why it is occurring and the solution is not elegant), but the second has got me stumped.
First Problem.
Unless I include a copy of the plugin dll in the gbpvr folder as well as the plugins\common folder, PVRX2 throws the following exception then when executing
settings = (Settings)ser.Deserialize(rdr);
It would appear the GBPVR and PVRX2 require the plugin DLL be in the GBPVR folder for the xmlserializer to work. I don't get this error if the dll is in both the GBPVR folder and the plugins\common or plugins\legacy folder
Second Problem.
So I copy my dll in to the GBPVR folder but when the plugin gets to
settings = (Settings)ser.Deserialize(rdr);
I get in the following log message:
Looking for missing assembly in plugin\common: ExternalDisplay.XmlSerializers, Version=0.0.2842.37635, Culture=neutral, PublicKeyToken=null
(My plugin is ExternalDisplay.dll)
Interestingly, the deserializer is working ok for the first couple of lines of the xml file that contain XMLAttributes, but then crashes when trying to deserialize an XMLElementâ and only when run as a plugin. It works fine as a console app, so I know the code and xml file are correctly working.:confused:
Now for some reason, I am unable also unable to use sgen to create an ExternalDisplay.xmlseralizers file. I get an âUnable to load one or more of the requested typesâ error, so I canât even create this file to put in the plugins\common folder to see if that would solve the problem. Googling the error message offers no obvious solutions to the problem.
So my questions are:
The last question is the most important one
First Problem.
Unless I include a copy of the plugin dll in the gbpvr folder as well as the plugins\common folder, PVRX2 throws the following exception then when executing
settings = (Settings)ser.Deserialize(rdr);
Code:
System.InvalidOperationException: There is an error in XML document (0, 0). ---> System.TypeInitializationException: The type initializer for 'Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSettings' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSettings..cctor()
--- End of inner exception stack trace ---
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSettings..ctor()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract.get_Reader()
at System.Xml.Serialization.TempAssembly.InvokeReader(XmlMapping mapping, XmlReader xmlReader, XmlDeserializationEvents events, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at ProcessPlugins.ExternalDisplay.Settings.Load() in y:\SharpDevelop Projects\External Display\ExternalDisplayPlugin\Settings.cs:line 513
It would appear the GBPVR and PVRX2 require the plugin DLL be in the GBPVR folder for the xmlserializer to work. I don't get this error if the dll is in both the GBPVR folder and the plugins\common or plugins\legacy folder
Second Problem.
So I copy my dll in to the GBPVR folder but when the plugin gets to
settings = (Settings)ser.Deserialize(rdr);
I get in the following log message:
Looking for missing assembly in plugin\common: ExternalDisplay.XmlSerializers, Version=0.0.2842.37635, Culture=neutral, PublicKeyToken=null
(My plugin is ExternalDisplay.dll)
Interestingly, the deserializer is working ok for the first couple of lines of the xml file that contain XMLAttributes, but then crashes when trying to deserialize an XMLElementâ and only when run as a plugin. It works fine as a console app, so I know the code and xml file are correctly working.:confused:
Now for some reason, I am unable also unable to use sgen to create an ExternalDisplay.xmlseralizers file. I get an âUnable to load one or more of the requested typesâ error, so I canât even create this file to put in the plugins\common folder to see if that would solve the problem. Googling the error message offers no obvious solutions to the problem.
So my questions are:
- why can't I deserializer the XMLElements as a plugin, but when the code is run as a console app, it deserializes perfectly? (I think it might be related to the next question)
- why does PVRX2 appear to expect to find the plugin.xmlserializers in plugins\common? I thought that using sgen to create this file is only required for optimisation, and that the xmlserializer will work without the file, generating it âon the flyâ from the dll. (I am almost certain this is the case, because I can run my code as a console application without errors â the config.xml file can deserialized; be modified by my console app; and then serialized and saved back to the file correctly, but the file cannot be loaded/deserialized when the code is run as a plugin)
- how can I resolve the error I get with sgen?
- why does PVRX2 seem to require the plugin dll to be in the GBPVR folder in order for the xmlserializer to work.
- how can I get the xmlserializer to work properly as a plugin?
The last question is the most important one
[SIZE="1"]Silverstone GD01S-MXR (three dead rows of pixels in the LCD and defective remote control), Power: Zalman ZM460B-APS (blew up - can't remember what's there now); CPU: Pentium D 3.2 GHz with Asus V72 Cooler; MD: Asus P5LD2 Deluxe 2048MB,
WDC WD10EADS 1TB Data, 320GB System, Asus EN9400GT Silent 512MB, Hauppauge HVR 1300,
XP Home SP3, GB-PVR 2.0, ExternalDisplay v0.3[/SIZE]
WDC WD10EADS 1TB Data, 320GB System, Asus EN9400GT Silent 512MB, Hauppauge HVR 1300,
XP Home SP3, GB-PVR 2.0, ExternalDisplay v0.3[/SIZE]