Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Issue casting delegate to another with same signature

Open jayrulez opened this issue 1 year ago • 0 comments

using System;

class Program
{
	public static void Main()
	{
		Event<delegate void(int)> ev = .();
		//Event<delegate void(int id)> ev = .(); // replacing the line above with this works around the bug

		void handler(int id){}

		delegate void(int id) handlerDelegate = scope => handler;

		ev.Add(handlerDelegate);

		ev.Remove(handlerDelegate);
	}
}

The test case above reproduces the issue. It seems like a bug that casting delegate void(int id) to delegate void(int) triggers a runtime error.

jayrulez avatar Jun 26 '23 05:06 jayrulez