ArxOne / MrAdvice

.NET aspect weaver (build task under NuGet package)
MIT License
311 stars 45 forks source link

Inline functions error in v.2.5.19 #127

Closed hhblaze closed 5 years ago

hhblaze commented 6 years ago

Hi and a Happy New Year!

What is a year without new challenges??? So...

Before was installed v.2.5.16 and following block of code was working:

public void TEST()
        {
...
// inline function
  IEnumerable<string> PrepareListItem()
            {
                for (int xi = 0; xi < 5; xi++)
                {
                    if (xi == 2)
                        continue;                       
                    listItemTmpl.Object = new { lIndex = xi, name = "kooo" };  
                    yield return listItemTmpl.Render();  
                }
            }
//inline function call
tmpl.SetBlockText("list", PrepareListItem());
...
}

after upgrade there is an error:

Severity Code Description Project File Line Suppression State Error Unhandled exception: dnlib.DotNet.Writer.ModuleWriterException: Instruction is missing in body but it's still being referenced by PDB data. Method System.Boolean GM_PersonalDevice._EntryPoint/<>c__DisplayClass13_0/<g__PrepareListItem|0>d::MoveNext() (0x06000B1B), instruction: IL_0020: ldarg.0 at dnlib.DotNet.DummyLogger.Log(Object sender, LoggerEvent loggerEvent, String format, Object[] args) at dnlib.DotNet.Pdb.WindowsPdb.PdbCustomDebugInfoWriter.Error(String message, Object[] args) at dnlib.DotNet.Pdb.WindowsPdb.PdbCustomDebugInfoWriter.GetInstructionOffset(Instruction instr, Boolean nullIsEndOfMethod) at dnlib.DotNet.Pdb.WindowsPdb.PdbCustomDebugInfoWriter.Write(IList1 customDebugInfos) at dnlib.DotNet.Pdb.WindowsPdb.WindowsPdbWriter.Write(MethodDef method, List1 cdiBuilder) at dnlib.DotNet.Pdb.WindowsPdb.WindowsPdbWriter.Write() at dnlib.DotNet.Writer.ModuleWriterBase.WriteWindowsPdb(PdbState pdbState) at dnlib.DotNet.Writer.ModuleWriterBase.WritePdbFile() at dnlib.DotNet.Writer.ModuleWriter.WriteFile() at dnlib.DotNet.Writer.ModuleWriter.WriteImpl() at dnlib.DotNet.Writer.ModuleWriterBase.Write(Stream dest) at dnlib.DotNet.Writer.ModuleWriterBase.Write(String fileName) at dnlib.DotNet.ModuleDef.Write(String filename, ModuleWriterOptions options) at StitcherBoy.Reflection.ModuleManager.Write(String assemblyOriginatorKeyFile) at StitcherBoy.Weaving.Build.AssemblyStitcher.Process(StringDictionary parameters, Guid buildID, DateTime buildTime, String entryAssemblyPath) at StitcherBoy.Weaving.StitcherProcessor.Process(StringDictionary parameters, Guid buildID, DateTime buildTime, String entryAsemblyPath) at StitcherBoy.Weaving.StitcherProcessor.Process(StringDictionary parameters, Guid buildID, DateTime buildTime, String entryAsemblyPath) at StitcherTask`1.Run(Boolean fromExe) GM_PersonalDevice

picrap commented 6 years ago

That's a regression... I'll take a look at it.

snekbaev commented 6 years ago

Is this related to my findings in #106 ?

picrap commented 6 years ago

@snekbaev Yes, probably. I really need to work on this...

picrap commented 5 years ago

Can someone provide me a clean sample with such an error? I can't reproduce it.

hhblaze commented 5 years ago

It works in the latest version!

image