I recently did a LOT of research into this, and I understand that when DnD is off it will play.
But as you can see below, there are many different DnD modes:
Select Ret
Case 0
Log("DnD: Off")
Case 1
Log("DnD: Priority Only")
Case 2
Log("DnD: Total Silence")
Case 3
Log("DnD: Alarms Only")
Case -1
Log("DnD: SettingNotFoundException occured ?")
End Select
So, if your phone is in DnD mode "Total Silence", MP may not throw an error - it just wont play.
My device allows me to set which mode DnD goes into when I turn DnD on. I'll bet your device is set to go into "Total Silence" when in DnD mode and that's why it wont play.
Simply change your DnD mode to "Alarms Only" or "Priority Only" and MP should play when DnD is on.
Then have you app check the DnD mode instead of relying on an error to detect if MP will play or not.