【问题标题】:Why can't I decompile System.IdentityModel.Services.dll?为什么我无法反编译 System.IdentityModel.Services.dll?
【发布时间】:2014-07-30 07:06:24
【问题描述】:

我正在尝试反编译System.IdentityModel.Services.dll,但没有一个反编译工具显示方法详细信息

我什至无法在 ILDASM 中获得这些方法的 IL。 ILSpy 也是如此。

例如:System.IdentityModel.Services.SessionAuthenticationModule

ILDASM:

.method family hidebysig newslot virtual 
        instance void  OnAuthenticateRequest(object sender,
                                             class [mscorlib]System.EventArgs eventArgs) cil managed
{
  // Code size       0 (0x0)
} // end of method SessionAuthenticationModule::OnAuthenticateRequest


.method family hidebysig instance class [mscorlib]System.Collections.ObjectModel.ReadOnlyCollection`1<class [mscorlib]System.Security.Claims.ClaimsIdentity> 
        ValidateSessionToken(class [System.IdentityModel]System.IdentityModel.Tokens.SessionSecurityToken sessionSecurityToken) cil managed
{
  // Code size       0 (0x0)
} // end of method SessionAuthenticationModule::ValidateSessionToken

我曾认为至少 IL 始终可用。不是这样吗?

【问题讨论】:

  • 我猜你不是在反编译实际的代码程序集,而是一个参考程序集(它只包含元数据)。如果反汇编程序显示代码大小为零,则没有方法体可显示。 “真正的”程序集可能存储在其他地方(%WINDIR%\Microsoft.NET、GAC 等)。

标签: wif asp.net-identity decompiling ildasm ilspy


【解决方案1】:

r# 能够找到 microsoft 参考源,Reflector 能够生成:

    protected ReadOnlyCollection<ClaimsIdentity> ValidateSessionToken(SessionSecurityToken sessionSecurityToken)
{
    ReadOnlyCollection<ClaimsIdentity> onlys;
    SessionSecurityTokenHandler handler = base.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers[typeof(SessionSecurityToken)] as SessionSecurityTokenHandler;
    if (handler == null)
    {
        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString("ID4011", new object[] { typeof(SessionSecurityToken) })));
    }
    try
    {
        onlys = new ReadOnlyCollection<ClaimsIdentity>(handler.ValidateToken(sessionSecurityToken, this.CookieHandler.Path));
    }
    catch (SecurityTokenExpiredException exception)
    {
        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FederatedSessionExpiredException(DateTime.UtcNow, sessionSecurityToken.ValidTo, exception));
    }
    catch (SecurityTokenNotYetValidException exception2)
    {
        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FederationException(SR.GetString("ID1071", new object[] { DateTime.UtcNow, sessionSecurityToken.ValidFrom }), exception2));
    }
    return onlys;
}

ILSpy 是 生成非常相似的代码。所以我猜你看错了 组装或缺少其他东西。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    • 1970-01-01
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 2012-12-31
    相关资源
    最近更新 更多