The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help

Re: Null Reference Exception

  •  02-11-2008, 9:08 PM

    Re: Null Reference Exception

    Hi,

    A bunch of reasons why that wouldn't work :

    - you dont get a now playing window in RDP (which is required by the PlayMedia method)

    - you probably should'nt be tring to do that stuff from a background thread (which I think is what's happening in a deffered invoke)...

    - also not sure if you're stripping lines out (to give us a cleaner view of your code) - but you really need to have try/catch handlers around ALL that code - with 'graceful' handling of each level of problems (ie. first check you're actually getting a refrence back from the .Current - and then that the PlayMedia has been successful etc etc before you go set a Position on it) - otherwise your asking for a crashes and unpredictable behaviour. (and it's much much harder to locate the line of code / and property in that line thats throwing the error).

    Niall

     

     

View Complete Thread
Powered by Community Server, by Telligent Systems