CsWinRT
CsWinRT copied to clipboard
Unnecessary GuidGenerator calls for custom delegates in authored types
Describe the bug
We're emitting some GuidGenerator
calls when using custom delegates in authored components:
Pretty sure we could just literally hardcoded that same GUID we added on the ABI type for the delegate instead?
To Reproduce
public sealed unsafe partial class HelloWorldEffect
{
public event MyEventHandler Foo;
}
public delegate void MyEventHandler(object sender, string args);
Expected behavior
We should probably emit that IID in a static readonly field, and then reference it wherever needed.
Version Info
2.0.5-prerelease.240203.7
This is probably getting optimized by IIDOptimizer today, but I agree we can move this to a readonly static field.
If that's the case I think we should probably also fix #1478? Because otherwise IIDOptimizer will break in libraries, and if you just opt-out, then that path will not be optimized by it. I mean I agree here we can just update the code writer, but this just makes me think that in general, the IIDOptimizer should also run on authored libraries then? 🤔