前言: 早上上班按照正常流程打开Visual Studio,调试本地项目,然后奇怪的是一直提示未加载mscorlib.pdb,导致项目无法正常运行,经过一番折腾最后解决了这个突如其来的bug!
0> [mscorlib]System.Collections.Generic.List`1::GetEnumerator() 42 L_0034: stloc.3 43...0 [mscorlib]System.Collections.Generic.List`1/Enumerator`0::get_Current() 46 L_003e:...[mscorlib]System.Collections.Generic.List`1/Enumerator`0 60 L_005f: callvirt instance...void [mscorlib]System.IDisposable::Dispose() 61 L_0064: nop 62 L_0065: endfinally...63 L_0066: nop 64 L_0067: call valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console
]System.DateTime [mscorlib]System.DateTime::get_Now() IL_0006: box [mscorlib]System.DateTime...]System.Action`3 class [System.Core]System.Runtime.CompilerServices.CallSite`1::Invoke(!
]System.Threading.Thread::.ctor(class [mscorlib]System.Threading.ThreadStart) IL_0023: stloc.0...IL_0024: ldloc.0 IL_0025: callvirt instance void [mscorlib]System.Threading.Thread::Start()...IL_002a: nop IL_002b: call int32 [mscorlib]System.Console::Read() IL_0030: pop...]System.Threading.Thread::.ctor(class [mscorlib]System.Threading.ThreadStart) IL_001d: stloc.1...IL_001e: ldloc.1 IL_001f: callvirt instance void [mscorlib]System.Threading.Thread::Start()
3 .entrypoint 4 // Code size 47 (0x2f) 5 .maxstack 4 6 .locals init ([0] class [mscorlib...IL_0007: ldc.i4.1 11 IL_0008: ldstr "Value1" 12 IL_000d: callvirt instance void class [mscorlib...IL_0014: ldc.i4.2 17 IL_0015: ldstr "Value2" 18 IL_001a: callvirt instance void class [mscorlib...IL_0021: ldc.i4.3 23 IL_0022: ldstr "Value3" 24 IL_0027: callvirt instance void class [mscorlib...3 .entrypoint 4 // Code size 47 (0x2f) 5 .maxstack 4 6 .locals init ([0] class [mscorlib
managed { .entrypoint // Code size 17 (0x11) .maxstack 8 IL_0000: call class [mscorlib...]System.Action ExtendMwthod.Program::bibao() IL_0005: callvirt instance void [mscorlib]System.Action...::Invoke() IL_000a: call valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console:....method public hidebysig static class [mscorlib]System.Action bibao() cil managed { // Code...ExtendMwthod.Program/'c__DisplayClass1_0'::'b__0'() IL_0013: newobj instance void [mscorlib
]System.Console::WriteLine(string) //print "参数错误" L_0055: ret L_0056: call class [mscorlib]...]System.String::Join(string, class [mscorlib]System.Collections.Generic.IEnumerable`1) L_...]System.String::Join(string, class [mscorlib]System.Collections.Generic.IEnumerable`1) L_...014a: ldstr "}" L_014f: call string [mscorlib]System.String::Concat(string, string, string) L...L_015b: call void [mscorlib]System.Console::WriteLine(string) L_0160: ret }
]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01...0> class [mscorlib]System.Threading.Tasks.Task`1::GetAwaiter() //调用GetData()返回Task的GetAwaiter...`1 //初始化结构,也就是V_1 = default(TaskAwaiter) 54 IL_0073: call void [mscorlib...]System.Runtime.CompilerServices.AsyncVoidMethodBuilder::SetException(class [mscorlib]System.Exception...先看看ExecutionContext https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/Threading/
ldarg.0 12 IL_000d: call instance int32 csharp6.Person::get_Age() 13 IL_0012: box [mscorlib...IL_0095: stloc.s s4 2 IL_0097: ldstr "Hello, {0}" 3 IL_009c: ldc.i4.1 4 IL_009d: newarr[mscorlib...]System.FormattableString[mscorlib] System.Runtime.CompilerServices.FormattableStringFactory::Create(...IL_00b0: stloc.s s5 14 IL_00b2: ldstr "Hello, {0}" 15 IL_00b7: ldc.i4.1 16 IL_00b8: newarr[mscorlib...]System.FormattableString[mscorlib] System.Runtime.CompilerServices.FormattableStringFactory::Create(
System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) (IL=epilog, Native=0x6C9DB400+0x23) mscorlib.dll...System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) (IL=epilog, Native=0x6EC55D30+0x14) mscorlib.dll...millisecondsTimeout, bool hasThreadAffinity, bool exitContext) (IL≈0x0014, Native=0x6EC56B10+0x21) mscorlib.dll...millisecondsTimeout, bool hasThreadAffinity, bool exitContext) (IL≈0x0014, Native=0x6EC56B10+0x21) mscorlib.dll...System.Windows.Input.PenThreadWorker.ThreadProc() (IL≈0x00AF, Native=0x6C421E44+0x176) mscorlib.dll
1) dup ldstr "bbb" ldc.i4.1 call instance void class [mscorlib]System.Collections.Generic.Dictionary`...1) dup ldstr "ccc" ldc.i4.2 call instance void class [mscorlib]System.Collections.Generic.Dictionary`...1) dup ldstr "ddd" ldc.i4.3 call instance void class [mscorlib]System.Collections.Generic.Dictionary`...1) dup ldstr "eee" ldc.i4.4 call instance void class [mscorlib]System.Collections.Generic.Dictionary`...1) dup ldstr "fff" ldc.i4.5 call instance void class [mscorlib]System.Collections.Generic.Dictionary`
k__BackingField字段的IL 1 .field private string 'k__BackingField' 2 .custom instance void [mscorlib...]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState...hidebysig specialname instance string 2 get_Name() cil managed 3 { 4 .custom instance void [mscorlib...specialname instance void 2 set_Name(string 'value') cil managed 3 { 4 .custom instance void [mscorlib...csharp6.Person::'k__BackingField' 12 IL_0012: ldarg.0 13 IL_0013: call instance void [mscorlib
主要包含了程序集的一些属性:程序集名称、版本号、哈希算法、程序集模块等,以及对外部引用程序集的引用项: // Metadata version: v4.0.30319 .assembly extern mscorlib...) // .z\V.4.. .ver 4:0:0:0 } .assembly HelloIL { .custom instance void [mscorlib...(4)化繁为简,一览天下 这里将上面的IL代码简化一下,去粗取精来展现一下上面示例的IL代码,详细的分析以注释方式描述: // 加载外部程序集 .assembly extern mscorlib...// 指定编译目标程序集 .assembly HelloIL .class Program extends [mscorlib]System.Object {...// 调用静态方法WriteLine call void [mscorlib]System.Console::WriteLine(string) // 执行完毕
IL_0005: call void [mscorlib]System.Console::WriteLine(string) IL_000a: ldstr "hello"...IL_001e: call void [mscorlib]System.Console::WriteLine(string) IL_0023: ldc.i4.3 IL_0024:... newarr [mscorlib]System.String IL_0029: stloc.0 IL_002a: ldloc.0 IL_002b: ldc.i4.0 IL...Test::say(string[]) //结果2的调用 IL_0048: call valuetype [mscorlib...]System.ConsoleKeyInfo [mscorlib]System.Console::ReadKey() IL_004d: pop IL_004e: ret } // end of
并且它继承自程序集—mscorlib的System.Object类; 2)private,表示访问权限; 3)auto,表示程序的内存加载全部由CLR来控制; 4)ansi,是为了在没有托管代码与托管代码之间实现无缝转换...{ // 代码大小 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib...]System.Console::WriteLine(string) IL_000b: nop IL_000c: call string [mscorlib]System.Console...IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c:...call string [mscorlib]System.Console::ReadLine() IL_0011: pop IL_0012: ret } // end
World"); System.Console.ReadKey(); } } 该应用程序实现了打印"Hello World"的功能,该应用程序中引用到的系统类型都来自于MSCorLib.dll...Microsoft.NET\Framework64\v4.0.30319 第二步:执行以下命令 csc.exe /out:C:\Users\zc\Desktop\Program.exe /t:exe /r:MSCorLib.dll...输出文件的位置和输出文件的类型 3、/t(target):exe 生成的文件是Win32控制台应用程序类型 4、C:\Users\zc\Desktop\Program.cs 输入文件的位置 5、/r(reference):MSCorLib.dll...编译文件时需要引用的程序集 因为Console类型使框架定义的类型,所以必须指定其所在的dll文件,所以添加了/r(reference):MSCorLib.dll开关,告诉编译器在MSCorLib.dll...因为MSCorLib.dll是特殊文件,它包含几乎所有的核心类型,所以C#编译器会默认引用该类型,所以.命令可以简化成如下: csc.exe /out:C:\Users\zc\Desktop\Program.exe
{ 11 //......省略 12 //调用System.Delegate的静态方法Combine把委托对象添加到委托链表 13 IL_0008: call class[mscorlib...]System.Delegate[mscorlib]System.Delegate:: 14 Combine(class [mscorlib]System.Delegate, class...[mscorlib]System.Delegate) 15 //..省略 16 } 17 18 //注销事件 19 .method public hidebysig specialname...省略 24 //调用System.Delegate的静态方法Remove从委托链表中移除委托对象 25 IL_0008:callclass[mscorlib]System.Delegate...[mscorlib]System.Delegate:: 26 Remove(class [mscorlib]System.Delegate,class [mscorlib]System.Delegate
ildasm HelloWorld.exe /output=HelloWorld.il 然后就会生成一个.IL文件,这个文件进行HelloWorld.exe反编译后的代码 .assembly extern mscorlib...5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly HelloWorld { .custom instance void [mscorlib...corflags 0x00000001 .class private auto ansi beforefieldinit HelloWorld.HelloWorld extends [mscorlib....maxstack 8 IL_0000: nop IL_0001: ldstr "HelloWorld" IL_0006: call void [mscorlib...ctor() cil managed { .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib
将 mscorlib.dll 加载到 SharedDomain 共享及应用程序域。 记录字符串池中字符串常量。...\218db16dceaef380c6daf35c6a48f313\mscorlib.ni.dll ModLoad: 76490000 76573000 C:\Windows\SysWOW64\ole32...ReadFile+0xec 02 0138edf4 6ff1b275 mscorlib_ni+0x4b9b71 03 0138ee20 6ff1b17b mscorlib_ni!...]System.Console::WriteLine(string) IL_000b: nop IL_000c: call string [mscorlib]System.Console...C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll ------
领取专属 10元无门槛券
手把手带您无忧上云