public void GetReadParametersInInstanceContextShouldStartAtThisParameter() { var module = ModuleDefinition.FromFile(typeof(TestClass).Assembly.Location); var type = (TypeDefinition)module.LookupMember(typeof(TestClass).MetadataToken); var method = type.Methods .First(m => m.Name == nameof(TestClass.InstanceMethod)); var architecture = new CilArchitecture(method.CilMethodBody); var readVariables = new IVariable[1]; architecture.GetReadVariables(new CilInstruction(CilOpCodes.Ldarg_0), readVariables); Assert.Equal(new[] { method.Parameters.ThisParameter }, readVariables .Cast <CilParameter>() .Select(p => p.Parameter)); architecture.GetReadVariables(new CilInstruction(CilOpCodes.Ldarg_1), readVariables); Assert.Equal(new[] { method.Parameters[0] }, readVariables .Cast <CilParameter>() .Select(p => p.Parameter)); }