Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Song.fromURI()引发异常?_C#_C# 4.0_Xna_Xna 4.0 - Fatal编程技术网

C# Song.fromURI()引发异常?

C# Song.fromURI()引发异常?,c#,c#-4.0,xna,xna-4.0,C#,C# 4.0,Xna,Xna 4.0,我一直试图在我当前的应用程序中包含Song.FromURI()方法,但“CrossThreadMessaginException”总是出现 我已经开始了一个新的项目,从MSDN示例()中复制并粘贴了代码,但是异常仍然存在。它看起来是静默的(没有终止),但阻止访问任何成员 谢谢 Uri uriStreaming = new Uri("http://www.archive.org/download/gd1977-05-08.shure57.stevenson.29303.flac16/gd1977-

我一直试图在我当前的应用程序中包含Song.FromURI()方法,但“CrossThreadMessaginException”总是出现

我已经开始了一个新的项目,从MSDN示例()中复制并粘贴了代码,但是异常仍然存在。它看起来是静默的(没有终止),但阻止访问任何成员

谢谢

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'

XNA团队的肖恩·哈格里夫斯(Shawn Hargreaves)不久前在MSDN上发布了这篇文章,我认为这与您在这里看到的内容有关:

当您的计算机运行时,无法评估许多媒体播放器属性 程序在调试器中暂停。运行复杂的程序是不可能的 涉及与媒体播放器通信的属性获取程序 线程,因为该线程在程序中断时挂起 在调试器中,so无法运行正常运行的代码 报告属性的值

这只是一个调试器工件,如果 您可以正常运行程序,或者在调试器中单步执行程序。信息技术 仅影响调试器属性的显示,而不影响实际执行 你的代码