Fody/MethodTimer

Support method timing of vb.net async methods

kataras12 opened this issue · 1 comments

Describe the issue

Fix crash when adding Time attribute to Async methods on vb.net assemblies

Minimal Repro

Add below to a vb.net assembly

    <MethodTimer.Time>
    Private Async Function Test() As Task
        Await Task.Delay(1500)
    End Function

build, causes below exception

Severity	Code	Description	Project	File	Line	Suppression State
Error		Fody: An unhandled exception occurred:
Exception:
Failed to execute weaver C:\Users\x\.nuget\packages\methodtimer.fody\3.1.2\build\..\weaver\MethodTimer.Fody.dll
Type:
System.Exception
StackTrace:
   at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 210
   at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 111
Source:
FodyIsolated
TargetSite:
Void ExecuteWeavers()
An error occurred processing 'System.Threading.Tasks.Task WindowsApp6.Form1::Form1_Load(System.Object,System.EventArgs)'. Error: Sequence contains no elements
Type:
System.Exception
StackTrace:
   at AsyncMethodProcessor.Process()
   at ModuleWeaver.ProcessMethod(MethodDefinition method)
   at ModuleWeaver.ProcessAssembly()
   at ModuleWeaver.Execute()
   at InnerWeaver.ExecuteWeavers() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 198
Source:
MethodTimer.Fody
TargetSite:
Void Process()
Sequence contains no elements
Type:
System.InvalidOperationException
StackTrace:
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at AsyncMethodProcessor.InnerProcess()
   at AsyncMethodProcessor.Process()
Source:
System.Core
TargetSite:
TSource First[TSource](System.Collections.Generic.IEnumerable`1[TSource])	WindowsApp6			

Make an effort to fix the bug

#325

this is now deployed