Hey guys, 
I have a problem with an application that uses MediaPlayer. 
The code looks like this:
void PlayNext()
{
  mp.Next(this, MyPlayListContext);
  DisplayData();
}

mp = MediaPlayer, which is extended by me, Next method of it:
public static void Next(this MediaPlayer mp, Context context,
PlayListContext plc)
{
  try
  {
    SongData NextPlayed = plc.GetNextSong();
    MonoPlayer.SetDataSourceAndStart(mp, context, NextPlayed);
  }
  catch (NullReferenceException e)
  {
    Console.WriteLine(e.Message);
   }
 }

Now, when debugger is present, I get crash on mp.Next() - it says it's
NullReference. But both mp and MyPlayListContext are not null. The execution
doesnt get into Next function - break at try is not hit, it crashes before
it. When debugger is not present it works fine. On my friend's Samsung
Galaxy Ace (2.3.6) it works OK with debugger and without it. For me (HTC
Desire Z, 2.3.3) it crashes always at this place with debugger present, and
without debugger after playing 3rd song (so 3 times called Next, doesnt
matter what songs are etc, always 3 times). Is it a code bug or something
with my Phone? Also, we tested it with another friend on Samsung Galaxy SII
and it worked fine too.  So, is it due to my phone, android 2.3.3 or code is
bad (though it works everywhere, just not on my Desire Z)?
Also, what can be a problem - it says it's NullReference, but nothing is
null there - native exception?
Thanks for help,
Regards,
Konrad

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Application-crashes-when-debugger-present-without-debugger-no-crash-tp5610818p5610818.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to