You might want to shorten down your e-mails, because they're waaay for too long for a busy man to read. :)
As for your question, as far as I know, it does nothing compile-time, only comes into play during the runtime, in which it signals the CLR that the method should not be inlined or optimized. In C#, you can specify this using the MethodImplAttribute (or maybe MethodImplOptionsAttribute? I can't quite remember). 2011/7/13 Indiefreaks.com <[email protected]> > Ok, since I'm not getting answers, I believe this is a really > localized problem to my own R&D. > > Just a simple question: what the MethodDefinition.NoInlining and > MethodDefinition.NoOptimization properties do when saving the > Assembly? > > Thanks > > On Jul 12, 3:56 pm, "Indiefreaks.com" <[email protected]> > wrote: > > I have been trying to find out why my injected code doesn't run in > > vain. I wanted to share some IL code resulting from my game profiler > > to see if anyone could help identify the issue. > > > > As a reminder, CommanderApplication inherits from Application which > > holds an instance of a GameState class. > > The following methods get called > > CommanderApplication.Update() > > {_profilerAttributeXXX.StartProfilingMethod()}, > > Application.Update(){_profilerAttributeXXX.StartProfilingMethod()}, > > Application.Update(){_profilerAttributeXXX.EndProfilingMethod()}, > > CommanderApplication.Draw() > > {_profilerAttributeXXX.StartProfilingMethod()}, > > Application.Draw(){_profilerAttributeXXX.StartProfilingMethod()} > > Application.Draw(){_profilerAttributeXXX.EndProfilingMethod()} > > > > but these don't: > > CommanderApplication.Update() > > {_profilerAttributeXXX.EndProfilingMethod()}, > > CommanderApplication.Draw() > > {_profilerAttributeXXX.EndProfilingMethod()}, > > > > CommanderApplication Update: > > C# > > protected override void Update(GameTime gameTime) > > { > > __profilerAttribute131.ProfilingMethodStart(this, (MethodInfo) > > MethodBase.GetCurrentMethod()); > > base.Update(gameTime); > > __profilerAttribute131.ProfilingMethodEnd(); > > > > } > > > > IL > > .method family hidebysig virtual instance void Update(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime > > gameTime) cil managed > > { > > .maxstack 8 > > L_0000: ldsfld class > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > > Indiefreaks.Commander.CommanderApplication::__profilerAttribute131 > > L_0005: ldarg.0 > > L_0006: call class [mscorlib]System.Reflection.MethodBase > > [mscorlib]System.Reflection.MethodBase::GetCurrentMethod() > > L_000b: castclass [mscorlib]System.Reflection.MethodInfo > > L_0010: callvirt instance void > > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute::ProfilingMethodStart(object, > > class [mscorlib]System.Reflection.MethodInfo) > > L_0015: ldarg.0 > > L_0016: ldarg.1 > > L_0017: call instance void > > > [Indiefreaks.Game.Framework]Indiefreaks.Xna.Core.Application::Update(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime) > > L_001c: ldsfld class > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > > Indiefreaks.Commander.CommanderApplication::__profilerAttribute131 > > L_0021: call instance void > > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute::ProfilingMethodEnd() > > L_0026: ret > > > > } > > > > CommanderApplication Draw: > > C# > > protected override void Draw(GameTime gameTime) > > { > > __profilerAttribute132.ProfilingMethodStart(this, (MethodInfo) > > MethodBase.GetCurrentMethod()); > > base.Draw(gameTime); > > __profilerAttribute132.ProfilingMethodEnd(); > > ProfilingManager.Update(); > > > > } > > > > IL > > .method family hidebysig virtual instance void Draw(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime > > gameTime) cil managed > > { > > .maxstack 8 > > L_0000: ldsfld class > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > > Indiefreaks.Commander.CommanderApplication::__profilerAttribute132 > > L_0005: ldarg.0 > > L_0006: call class [mscorlib]System.Reflection.MethodBase > > [mscorlib]System.Reflection.MethodBase::GetCurrentMethod() > > L_000b: castclass [mscorlib]System.Reflection.MethodInfo > > L_0010: callvirt instance void > > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute::ProfilingMethodStart(object, > > class [mscorlib]System.Reflection.MethodInfo) > > L_0015: ldarg.0 > > L_0016: ldarg.1 > > L_0017: call instance void > > [Indiefreaks.Game.Framework]Indiefreaks.Xna.Core.Application::Draw(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime) > > L_001c: ldsfld class > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > > Indiefreaks.Commander.CommanderApplication::__profilerAttribute132 > > L_0021: call instance void > > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute::ProfilingMethodEnd() > > L_0026: call void > > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilingManager::Update() > > L_002b: ret > > > > } > > > > Application Update: > > C# > > protected override void Update(GameTime gameTime) > > { > > __profilerAttribute463.ProfilingMethodStart(this, (MethodInfo) > > MethodBase.GetCurrentMethod()); > > if ((SunBurn.Editor != null) && SunBurn.Editor.EditorAttached) > > { > > Input.Enabled = false; > > } > > else > > { > > Input.Enabled = true; > > } > > base.Update(gameTime); > > this.Threads.Update(); > > Interpolator.Update((float) > > gameTime.ElapsedGameTime.TotalSeconds); > > Timer.Update((float) gameTime.ElapsedGameTime.TotalSeconds); > > if (((this.ActiveGameState != null) && > > this.ActiveGameState.IsLoadingComplete) && ((this._loadingGameState == > > null) || this._loadingGameState.ShouldRenderLoadedGameState)) > > { > > ((IUpdate) this.ActiveGameState).Update(gameTime); > > } > > if (((this._loadingGameState != null) && > > this._loadingGameState.IsLoadingComplete) && ! > > this._loadingGameState.ShouldRenderLoadedGameState) > > { > > ((IUpdate) this._loadingGameState).Update(gameTime); > > } > > __profilerAttribute463.ProfilingMethodEnd(); > > > > } > > > > IL > > .method family hidebysig virtual instance void Update(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime > > gameTime) cil managed > > { > > .maxstack 3 > > .locals init ( > > [0] valuetype [mscorlib]System.TimeSpan CS$0$0000, > > [1] valuetype [mscorlib]System.TimeSpan CS$0$0001) > > L_0000: ldsfld class > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > > Indiefreaks.Xna.Core.Application::__profilerAttribute463 > > L_0005: ldarg.0 > > L_0006: call class [mscorlib]System.Reflection.MethodBase > > [mscorlib]System.Reflection.MethodBase::GetCurrentMethod() > > L_000b: castclass [mscorlib]System.Reflection.MethodInfo > > L_0010: callvirt instance void > > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute::ProfilingMethodStart(object, > > class [mscorlib]System.Reflection.MethodInfo) > > L_0015: call class [SynapseGaming-SunBurn- > > Pro]SynapseGaming.LightingSystem.Core.SceneInterface > > Indiefreaks.Xna.Core.Application::get_SunBurn() > > L_001a: callvirt instance class [SynapseGaming-SunBurn- > > Pro]SynapseGaming.LightingSystem.Editor.LightingSystemEditor > > [SynapseGaming-SunBurn- > > Pro]SynapseGaming.LightingSystem.Core.SceneInterface::get_Editor() > > L_001f: brfalse.s L_003f > > L_0021: call class [SynapseGaming-SunBurn- > > Pro]SynapseGaming.LightingSystem.Core.SceneInterface > > Indiefreaks.Xna.Core.Application::get_SunBurn() > > L_0026: callvirt instance class [SynapseGaming-SunBurn- > > Pro]SynapseGaming.LightingSystem.Editor.LightingSystemEditor > > [SynapseGaming-SunBurn- > > Pro]SynapseGaming.LightingSystem.Core.SceneInterface::get_Editor() > > L_002b: callvirt instance bool [SynapseGaming-SunBurn- > > > Pro]SynapseGaming.LightingSystem.Editor.LightingSystemEditor::get_EditorAttached() > > L_0030: brfalse.s L_003f > > L_0032: call class Indiefreaks.Xna.Input.InputManager > > Indiefreaks.Xna.Core.Application::get_Input() > > L_0037: ldc.i4.0 > > L_0038: callvirt instance void > > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameComponent::set_Enabled(bool) > > L_003d: br.s L_004a > > L_003f: call class Indiefreaks.Xna.Input.InputManager > > Indiefreaks.Xna.Core.Application::get_Input() > > L_0044: ldc.i4.1 > > L_0045: callvirt instance void > > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameComponent::set_Enabled(bool) > > L_004a: ldarg.0 > > L_004b: ldarg.1 > > L_004c: call instance void > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.Game::Update(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime) > > L_0051: ldarg.0 > > L_0052: call instance class Indiefreaks.Xna.Threading.ThreadPool > > Indiefreaks.Xna.Core.Application::get_Threads() > > L_0057: callvirt instance void > > Indiefreaks.Xna.Threading.ThreadPool::Update() > > L_005c: ldarg.1 > > L_005d: callvirt instance valuetype [mscorlib]System.TimeSpan > > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime::get_ElapsedGameTime() > > L_0062: stloc.0 > > L_0063: ldloca.s CS$0$0000 > > L_0065: call instance float64 > > [mscorlib]System.TimeSpan::get_TotalSeconds() > > L_006a: conv.r4 > > L_006b: call void > > Indiefreaks.Xna.Core.Interpolator::Update(float32) > > L_0070: ldarg.1 > > L_0071: callvirt instance valuetype [mscorlib]System.TimeSpan > > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime::get_ElapsedGameTime() > > L_0076: stloc.1 > > L_0077: ldloca.s CS$0$0001 > > L_0079: call instance float64 > > [mscorlib]System.TimeSpan::get_TotalSeconds() > > L_007e: conv.r4 > > L_007f: call void Indiefreaks.Xna.Core.Timer::Update(float32) > > L_0084: ldarg.0 > > L_0085: call instance class Indiefreaks.Xna.Core.GameState > > Indiefreaks.Xna.Core.Application::get_ActiveGameState() > > L_008a: brfalse.s L_00ba > > L_008c: ldarg.0 > > L_008d: call instance class Indiefreaks.Xna.Core.GameState > > Indiefreaks.Xna.Core.Application::get_ActiveGameState() > > L_0092: callvirt instance bool > > Indiefreaks.Xna.Core.GameState::get_IsLoadingComplete() > > L_0097: brfalse.s L_00ba > > L_0099: ldarg.0 > > L_009a: ldfld class Indiefreaks.Xna.Core.LoadingGameState > > Indiefreaks.Xna.Core.Application::_loadingGameState > > L_009f: brfalse.s L_00ae > > L_00a1: ldarg.0 > > L_00a2: ldfld class Indiefreaks.Xna.Core.LoadingGameState > > Indiefreaks.Xna.Core.Application::_loadingGameState > > L_00a7: callvirt instance bool > > Indiefreaks.Xna.Core.LoadingGameState::get_ShouldRenderLoadedGameState() > > L_00ac: brfalse.s L_00ba > > L_00ae: ldarg.0 > > L_00af: call instance class Indiefreaks.Xna.Core.GameState > > Indiefreaks.Xna.Core.Application::get_ActiveGameState() > > L_00b4: ldarg.1 > > L_00b5: callvirt instance void > > Indiefreaks.Xna.Core.IUpdate::Update(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime) > > L_00ba: ldarg.0 > > L_00bb: ldfld class... > > > > read more » > > -- > -- > mono-cecil -- -- mono-cecil
