- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我一直在尝试在我当前的应用程序中包含 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'
最佳答案
XNA 团队的 Shawn Hargreaves 不久前在 MSDN 上发布了这个,我认为它与你在这里的内容有关:
Many of the media player properties cannot be evaluated when your program is paused in the debugger. It's not possible to run complex property getters that involve communicating with the media player thread, because that thread is suspended while your program is broken in the debugger, so is unable to run the code that would normally report the value of the property.
This is just a debugger artifact, and should not cause any problems if you run your program normally, or step through it in the debugger. It only affects the debugger property display, not the actual execution of your code.
关于c# - Song.fromURI() 抛出异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15392396/
我一直在尝试在我当前的应用程序中包含 Song.FromURI() 方法,但总是出现“CrossThreadMessagingException”。 我已经开始了一个新项目,并从字面上复制并粘贴了 M
我使用 [FromUri] 在我的 web api 操作中获取参数,例如: public TestController { public ActionResult TestMethod([Fr
我正在使用 Asp.NET WebApi,让我感到困惑的一件事是完成请求时的绑定(bind)。 我有这个 ViewModel: [DataContract(Name="Store")] public
我正在尝试实现一个搜索过滤器以在我的一个 Controller 中获取对象。我有以下代码: public class SearchFilter { public DateTime? Busin
我在 web api 中有一个新方法 [HttpPost] public ApiResponse PushMessage( [FromUri] string x, [FromUri] string y
在使用 ASP.NET WebApi2 和 Swashbuckle/Swagger 时,我尝试使用 FromUri 属性绑定(bind)对象,如下所示: [RoutePrefix("api/v1/ex
我想将在 uri 中带有嵌套数组的复杂对象发送到 GET 请求中的 MVC 操作方法。 考虑以下代码: public ActionResult AutoCompleteHandler([FromUr
我有一个项目列表,每个项目都有一个图像(从远程服务器下载),如下所示: var image = new Image { WidthRequest
我们有多个 API Controller 接受 GET 请求,如下所示: //FooController public IHttpActionResult Get([FromUri]Foo f); /
我熟悉 FromBody 和 FromRoute。他们似乎很清楚。 我使用 FromUri 来处理映射到列表或 string[] 的多值参数。 FromQuery 听起来很相似,但有什么区别吗? 最佳
[Route("Street/{ZoneID}/{StreetID}/")] public HttpResponseMessage GetStreet(int ZoneID,int Stree
我有以下 API Controller 操作 [HttpGet] [Route("assets")] public async Task Get([FromUri]SearchCriteria sea
我正在尝试构建一个 RESTApi 端点,用户可以在其中发送多个 ID 来过滤特定资源。 因此我创建了一个请求对象,它可以在我自己的项目中重复使用以保持简单(至少对我而言)。 在构建 GET 调用 Q
我想使用属性路由和 [FromUri] 属性将 URL 参数绑定(bind)到我的 Point 对象,以便可以使用以下 URL: /foo-1,2 public IHttpActionResult P
在 WebApi 中,我可以使用 [FromUri] 修饰 Controller 操作上的参数,以便将 URI 的组件“反序列化”到 POCO 模型中;又名模型绑定(bind)。 尽管从 2.0 开始
我有一个带 url 的 MVC Controller ,它有一个参数绑定(bind),里面有方括号 public Product GetProduct([Bind(Prefix = "product
我正在使用 ImageSource.FromUri(new Uri("https://my image uri") 并且效果很好。 但是如何判断我是否已成功检索图像? 当我提供一个不存在的 URI 时
我目前正在创建一个新的 API,但我需要通过 URL 接收复杂的参数。我无法在不冒其他系统出错的风险的情况下轻松更改这些参数。 我正在使用 .Net Core 2.1,由于 [FromUri] 不存在
我在下面定义了一个 WebApi 操作。 (我使用的是 MediatR 库,它与我的问题略有相关) [HttpGet] [Route] public async Task Search([FromUr
我们正在使用 Asp.Net WebApi 创建 RestService。但由于某种原因,当尝试使用 [FromURI] 属性反序列化复杂属性时,Name 属性在 DataMember 属性中被忽略。
我是一名优秀的程序员,十分优秀!