inversionhourglass / Rougamo

Compile-time AOP component. Works with any method, whether it is async or sync, instance or static. Uses an aspectj-like pattern to match methods.
MIT License
393 stars 47 forks source link

try catch 中包含空 trhow new exception 报错 #83

Closed food4321 closed 1 month ago

food4321 commented 1 month ago
          实在不好意思,无意间又发现一个问题。

以下代码也会报错,这是什么问题呢?

[Log]
public void TestThrow()
{
    try
    {
        throw new Exception("test");
    }
    catch (Exception)
    {

        throw;
    }            
}
错误      Fody/Rougamo: System.ArgumentNullException: 值不能为 null。
参数名: key
   在 System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   在 System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   在 System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   在 Mono.Cecil.MonoCloneExtension.Clone(MethodDefinition methodDef, MethodDefinition clonedMethodDef, Dictionary`2 map, Boolean withOverrides, Boolean cloneBody)
   在 Mono.Cecil.MonoCloneExtension.Clone(MethodDefinition methodDef, String methodName, Dictionary`2 map, Boolean cloneBody)
   在 Rougamo.Fody.ModuleWeaver.WeavingSyncMethod(RouMethod rouMethod)
   在 Rougamo.Fody.ModuleWeaver.WeaveMos()   WindowsFormsApp8    C:\Users\E00357\source\repos\WindowsFormsApp8\WindowsFormsApp8\Form1.cs 23  

Originally posted by @food4321 in https://github.com/inversionhourglass/Rougamo/issues/81#issuecomment-2345056269

inversionhourglass commented 1 month ago

已发布4.0.3-preview-1726120802,正式版本将于下周发布