protected void GetCompilationState <T>(DbgEvaluationInfo evalInfo, DbgModuleReference[] references, out DbgLanguageDebugInfo langDebugInfo, out MethodDef method, out int methodToken, out int localVarSigTok, out T state, out ImmutableArray <MetadataBlock> metadataBlocks, out int methodVersion) where T : EvalContextState, new() { langDebugInfo = evalInfo.Context.GetLanguageDebugInfo(); method = langDebugInfo.MethodDebugInfo.Method; methodToken = langDebugInfo.MethodToken; localVarSigTok = langDebugInfo.LocalVarSigTok; state = GetEvalContextState <T>(evalInfo.Frame); if (state.LastModuleReferences == references && !state.LastMetadataBlocks.IsDefault) { metadataBlocks = state.LastMetadataBlocks; } else { metadataBlocks = CreateMetadataBlock(references); state.LastModuleReferences = references; state.LastMetadataBlocks = metadataBlocks; } methodVersion = langDebugInfo.MethodVersion; }
protected GetMethodDebugInfo CreateGetMethodDebugInfo(EvalContextState evalContextState, DbgLanguageDebugInfo langDebugInfo) { if (evalContextState.CompilerGeneratedVariableInfosKey != langDebugInfo.MethodDebugInfo.Method) { evalContextState.CompilerGeneratedVariableInfosKey = langDebugInfo.MethodDebugInfo.Method; evalContextState.CompilerGeneratedVariableInfos = null; evalContextState.NotCompilerGenerated = null; } // If there's only one scope, we can cache the whole thing if (langDebugInfo.MethodDebugInfo.Scope.Scopes.Length == 0) { if (evalContextState.MethodDebugInfoKey != langDebugInfo.MethodDebugInfo.Method) { evalContextState.MethodDebugInfo = CreateMethodDebugInfo(langDebugInfo, ref evalContextState.CompilerGeneratedVariableInfos, ref evalContextState.NotCompilerGenerated); evalContextState.MethodDebugInfoKey = langDebugInfo.MethodDebugInfo.Method; } return(() => evalContextState.MethodDebugInfo); } evalContextState.MethodDebugInfo = default; evalContextState.MethodDebugInfoKey = null; return(() => CreateMethodDebugInfo(langDebugInfo, ref evalContextState.CompilerGeneratedVariableInfos, ref evalContextState.NotCompilerGenerated)); }