コード例 #1
0
ファイル: DkmClrType.cs プロジェクト: XieShuquan/roslyn
 internal DkmClrType(DkmClrModuleInstance module, DkmClrAppDomain appDomain, Type lmrType)
 {
     _module = module;
     _appDomain = appDomain;
     _lmrType = lmrType;
     _evalAttributes = GetEvalAttributes(lmrType);
 }
コード例 #2
0
 internal DkmClrRuntimeInstance(
     Assembly[] assemblies,
     GetModuleDelegate getModule = null,
     GetMemberValueDelegate getMemberValue = null)
 {
     if (getModule == null)
     {
         getModule = (r, a) => new DkmClrModuleInstance(r, a, (a != null) ? new DkmModule(a.GetName().Name + ".dll") : null);
     }
     this.Assemblies = assemblies;
     this.Modules = assemblies.Select(a => getModule(this, a)).Where(m => m != null).ToArray();
     _defaultModule = getModule(this, null);
     _appDomain = new DkmClrAppDomain(this);
     _getMemberValue = getMemberValue;
 }
コード例 #3
0
ファイル: DkmClrValue.cs プロジェクト: XieShuquan/roslyn
        public DkmClrValue InstantiateDynamicViewProxy(DkmInspectionContext inspectionContext)
        {
            if (inspectionContext == null)
            {
                throw new ArgumentNullException(nameof(inspectionContext));
            }

            var module = new DkmClrModuleInstance(
                this.Type.AppDomain.RuntimeInstance,
                typeof(Microsoft.CSharp.RuntimeBinder.RuntimeBinderException).Assembly,
                new DkmModule("Microsoft.CSharp.dll"));
            var proxyType = module.ResolveTypeName(
                "Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView",
                s_noArguments);
            return this.InstantiateProxyType(inspectionContext, proxyType);
        }
コード例 #4
0
 private ImportedModule ImportModule(DkmClrModuleInstance debuggerModule)
 {
     IntPtr metadataBlock;
     uint blockSize;
     try
     {
         metadataBlock = debuggerModule.GetMetaDataBytesPtr(out blockSize);
         return Session.Importer.ImportModule(metadataBlock, blockSize);
     }
     catch (DkmException)
     {
         // This can fail when dump debugging if the full heap is not available
         return null;
     }
 }
コード例 #5
0
 private EvaluationContextBase CreateTypeContext(DkmClrModuleInstance moduleInstance, ImmutableArray<MetadataBlock> references, int typeToken)
 {
     return this.CreateTypeContext(
         moduleInstance.AppDomain,
         references,
         moduleInstance.Mvid,
         typeToken);
 }
コード例 #6
0
        void IDkmClrExpressionCompilerCallback.CompileDisplayAttribute(
            DkmLanguageExpression expression,
            DkmClrModuleInstance moduleInstance,
            int token,
            out string error,
            out DkmCompiledClrInspectionQuery result)
        {
            try
            {
                var appDomain = moduleInstance.AppDomain;
                var references = moduleInstance.Process.GetMetadataBlocks(appDomain);

                ResultProperties unusedResultProperties;
                ImmutableArray<AssemblyIdentity> missingAssemblyIdentities;
                CompileResult compileResult;
                do
                {
                    var context = this.CreateTypeContext(moduleInstance, references, token);
                    compileResult = context.CompileExpression(
                        RuntimeInspectionContext.Empty,
                        expression.Text,
                        DkmEvaluationFlags.TreatAsExpression,
                        this.DiagnosticFormatter,
                        out unusedResultProperties,
                        out error,
                        out missingAssemblyIdentities,
                        preferredUICulture: null,
                        testData: null);
                } while (ShouldTryAgainWithMoreMetadataBlocks(appDomain, missingAssemblyIdentities, ref references));

                result = compileResult.ToQueryResult(this.CompilerId, default(ResultProperties), moduleInstance.RuntimeInstance);
            }
            catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }