System.Core抛出的“代码应该无法访问” [英] 'Code supposed to be unreachable' thrown by System.Core

查看:67
本文介绍了System.Core抛出的“代码应该无法访问”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个异常,当在代码下面执行时,来自System.Core的消息'System.InvalidOperationException:Code that is unreachable'

I've got an exception with the message 'System.InvalidOperationException: Code supposed to be unreachable' originating from System.Core when performing underneath code

 


public ushort RemoveProvider(ulong providerId)
{
  //make sure the provider isn't referenced by any device
  var refDevices = (from device in DataContext.Linq<Device>()
               where device.Active && device.Providers.Select(x => x.ID).Contains(providerId)
               select device).ToList();
  ....
}

推荐答案

如果执行underbeath代码,一切工作正常

If executing underbeath code, everything works fine


var refDevices = (from device in DataContext.Linq<Device>().ToList()
              where device.Active && device.Providers.Select(x => x.ID).ToList().Contains(providerId)
              select device).ToList();


这篇关于System.Core抛出的“代码应该无法访问”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆