private void SetupReturnVariable() { if (_resultVar != null) { throw new InvalidOperationException("Something went wrong"); } if (TargetMethod.ReturnType.IsTypeOf(typeof(void)) && !TargetMethod.IsSetter) { return; } //todo:: optimize for compiller generated (get backing field) if (TargetMethod.IsSetter) { var prop = TargetMethod.DeclaringType.Properties.First(p => p.SetMethod == TargetMethod); _resultVar = EntryPoint.CreateVariable(prop.GetMethod.ReturnType, MethodResultVariableName, c => { c.LoadSelfOntoStack(); c.InjectMethodCall(prop.GetMethod); }); } else { _resultVar = OriginalEntryPoint.CreateVariable(TargetMethod.ReturnType, MethodResultVariableName); } }