我一直在尝试在我当前的应用程序中包含Song.FromURI()方法,但是总是出现"CrossThreadMessagingException“。
我已经启动了一个新项目,从字面上复制并粘贴了MSDN示例(http://msdn.microsoft.com/en-us/library/ff634558.aspx)中的代码,但仍然会发生异常。它显示为静默(无终止),但阻止访问任何成员。
谢谢。
Uri uriStreaming = new Uri("http://www.archive.org/download/gd1977-05-08.shure57.stevenson.29303.flac16/gd1977-05-08d02t06_vbr.mp3");
Song song = Song.FromUri("StreamingUri", uriStreaming);
'song.Album' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException'
'song.Artist' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException'
'song.Genre' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException'
'song.PlayCount' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException'
发布于 2013-04-10 18:43:06
来自XNA团队的Shawn Hargreaves不久前在MSDN上发布了这篇文章,我相信这是相对于这里的内容:
当您的程序在调试器中暂停时,无法计算许多媒体播放器属性。不可能运行涉及到与媒体播放器线程通信的复杂属性getter,因为当您的程序在调试器中中断时,该线程会挂起,因此无法运行通常会报告属性值的代码。
这只是一个调试器工件,如果您正常运行程序或在调试器中逐步执行它,应该不会造成任何问题。它只影响调试器属性的显示,而不影响代码的实际执行。
https://stackoverflow.com/questions/15392396
复制相似问题