Пример #1
0
        public DotNetDesktopStubMethodBodyEmitter(IMetadataHost host)
            : base(host)
        {
            this.consoleWriteLine = new Microsoft.Cci.MethodReference(host,
                                                                      GarbageCollectHelper.CreateTypeReference(host, coreAssemblyReference, "System.Console"),
                                                                      CallingConvention.Default,
                                                                      host.PlatformType.SystemVoid,
                                                                      host.NameTable.GetNameFor("WriteLine"),
                                                                      0,
                                                                      host.PlatformType.SystemString);

            this.environmentGetStackTrace = new Microsoft.Cci.MethodReference(host,
                                                                              GarbageCollectHelper.CreateTypeReference(host, coreAssemblyReference, "System.Environment"),
                                                                              CallingConvention.Default,
                                                                              host.PlatformType.SystemString,
                                                                              host.NameTable.GetNameFor("get_StackTrace"),
                                                                              0);

            this.environmentExit = new Microsoft.Cci.MethodReference(host,
                                                                     GarbageCollectHelper.CreateTypeReference(host, coreAssemblyReference, "System.Environment"),
                                                                     CallingConvention.Default,
                                                                     host.PlatformType.SystemVoid,
                                                                     host.NameTable.GetNameFor("Exit"),
                                                                     0,
                                                                     host.PlatformType.SystemInt32);
        }
Пример #2
0
        public WindowsPhoneStubMethodBodyEmitter(IMetadataHost host)
            : base(host)
        {
            this.consoleWriteLine = new Microsoft.Cci.MethodReference(host,
                                                                      GarbageCollectHelper.CreateTypeReference(host, coreAssemblyReference, "System.Console"),
                                                                      CallingConvention.Default,
                                                                      host.PlatformType.SystemVoid,
                                                                      host.NameTable.GetNameFor("WriteLine"),
                                                                      0,
                                                                      host.PlatformType.SystemString);

            this.stackTraceConstructor = new Microsoft.Cci.MethodReference(host,
                                                                           GarbageCollectHelper.CreateTypeReference(host, coreAssemblyReference, "System.Diagnostics.StackTrace"),
                                                                           CallingConvention.HasThis,
                                                                           host.PlatformType.SystemVoid,
                                                                           host.NameTable.GetNameFor(".ctor"),
                                                                           0);

            this.toString = new Microsoft.Cci.MethodReference(host,
                                                              host.PlatformType.SystemObject,
                                                              CallingConvention.HasThis,
                                                              host.PlatformType.SystemString,
                                                              host.NameTable.GetNameFor("ToString"),
                                                              0);
        }
Пример #3
0
        protected void AppendEmitExceptionThrow(ILGenerator generator)
        {
            var systemExceptionTypeReference = GarbageCollectHelper.CreateTypeReference(host, coreAssemblyReference, "System.Exception");

            IMethodReference exceptionConstructor = new Microsoft.Cci.MethodReference(
                host,
                systemExceptionTypeReference,
                CallingConvention.HasThis,
                host.PlatformType.SystemVoid,
                host.NameTable.Ctor,
                0);

            generator.Emit(OperationCode.Newobj, exceptionConstructor);
            generator.Emit(OperationCode.Throw);
        }