exception - 异常不再被捕获
问题描述
以下代码工作正常。然后我将文件传输到另一个位置(VS2019 社区的另一个实例)。现在,异常不再被捕获,并且代码在调试期间中断。这怎么解释?谢谢
private List<string> getMembers(string objectName)
{
List<string> result = new List<string>();
List<string> listMembers = new List<string>();
try
{
PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain);
UserPrincipal up = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, objectName);
string groupList = "";
foreach (var group in up.GetGroups())
{
groupList += group.SamAccountName + "|";
}
result.Add(objectName + tab + groupList);
}
catch (Exception ex)
{
result.Add(objectName + tab + "Error: " + ex.Message);
}
return result;
}
解决方案
pdb 文件损坏/丢失的情况。代码没有错。
推荐阅读
- html - 元素数量未知的嵌套表
- regex - PostgreSQL 正则表达式仅识别特殊字符
- react-native - 如何在IOS设备中查看RNFetchBlob下载的文件
- api - Twitter API 在扩展实体中重复 url
- google-cloud-platform - 谷歌云机器网络重启刷新iptables
- swift - 如何从 Int 设置 UIColor?
- logging - Solr:修改dih请求的日志
- html - 让 iOS 的 VoiceOver 忽略 HTML 页面上的元素?
- php - PHP 不断为 Telegram userbot 运行
- c# - 如何在 ASP.NET Core Webapi 中添加身份角色