首页 > 解决方案 > 异常不再被捕获

问题描述

以下代码工作正常。然后我将文件传输到另一个位置(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;

    }

标签: exception

解决方案


pdb 文件损坏/丢失的情况。代码没有错。


推荐阅读