NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 11 12 13 14 15 … 93 Next »
Weird Code problem - serialisation (I'll spell it the proper way!!"0

 
  • 0 Vote(s) - 0 Average
Weird Code problem - serialisation (I'll spell it the proper way!!"0
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#1
2011-11-13, 09:48 PM
So have a weird code problem with c# serialisation.

I have a windows form project using a bunch of classes that deserialise an XML feed. Works perfectly.

If I share. or copy the code files used for the deserialisation (there's a bunch of classes) into a project that is a plugin, then on the very first deseralisation I get a failure in the xml at 0,0 - with the inner exception getting an object reference not found.

The URL location of the xml is the same for both projects. Even saving the XML to disk in the windows form and opening that in the plugin gets the same problem....but saving the XML in the plugin and opening it in the windows form works.

Really stuck. The only possible thing I can think of may be that the Plugin is targeting dotnet 3.5.

Any other suggestions?
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#2
2011-11-13, 10:20 PM
Any app.config changes in the WinForms app?
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#3
2011-11-13, 10:46 PM
No, they both just say supportedversion v2.0xxxx etc (they match). I did add something to the plugin one for keeping the serialisation files, but it hasn't had the affect I wanted.
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#4
2011-11-13, 10:50 PM
hmm may be on to something.

I'm using a a typed System.Collections.Generic.List<classname> and just changed it to a straight array of classname[] and it got further. Weirdness.
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#5
2011-11-13, 10:51 PM
But why this would work with Windows forms and not as a plugin I have no idea.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#6
2011-11-16, 08:21 PM
Couple of things to check:

1. All your classes used in deserialization should have a public, empty constructor: public MyClass() {}
2. All lists/dictionaries should be initialized before deserialization. private List<string> myList = new List<string>();
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#7
2011-11-16, 08:25 PM
Yeah I had all that. Everything I was reading was saying I should have been able to do it with a List<object>

But just couldn't get it to work. Had to use arrays instead.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#8
2011-11-16, 08:47 PM
I've never had trouble using Lists. You have a sample of the non working code (and xml file)?
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#9
2011-11-16, 09:07 PM
When I say couldn't get it to work, I mean, It worked in windows forms perfectly. But not as a plugin.

Sorry, No I've moved well past this now so couldn't push it back to being a list.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#10
2011-11-16, 11:11 PM
I figured you had moved past it. I just wanted to satisfy my own curiosity.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Remote control example code? drmargarit 4 3,763 2018-04-21, 11:24 PM
Last Post: drmargarit
  Looking for C# UPnP Media Server code bgowland 5 7,601 2016-12-16, 08:25 PM
Last Post: mvallevand
  Problem with preview image for Pending Recordings Northpole 2 1,982 2012-08-14, 02:56 AM
Last Post: Northpole
  ActivatePopup: SSPlus problem ACTCMS 10 4,743 2012-07-18, 09:43 PM
Last Post: ACTCMS
  Resolving required plugin assemblies problem McBainUK 37 11,982 2011-10-26, 06:12 PM
Last Post: psycik
  sample video overlay plugin source code? reven 2 2,336 2011-10-03, 12:42 AM
Last Post: reven
  C# code to get data directory? McBainUK 2 2,780 2011-09-19, 07:57 PM
Last Post: McBainUK
  Source code for older versions ? Spark 1 1,744 2011-02-23, 01:19 AM
Last Post: sub
  Problem using UIStatic philcooling 13 4,353 2010-02-12, 06:34 PM
Last Post: whurlston
  special MVP code? scb147 31 8,382 2009-09-04, 02:50 AM
Last Post: scb147

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode