I'm not sure what is the proper feedback channel for the Microsoft.Diagnostics.Tracing.EventRegister 1.0.26, Microsoft.Diagnostics.Tracing.EventSource 1.0.26, and Microsoft.Diagnostics.Tracing.EventSource.Redist 1.0.26 NuGet packages, so I'll just post these here.
We've got a service that uses those packages for writing events to Windows Event Log. It thus needs a provider manifest with channels and such. The messages and maps are localized to a few languages.
- When the project is being built on .NET Framework 4.0 (not 4.5.1), eventRegister.exe does not find the satellite assemblies that contain the localized strings, so it silently omits the corresponding <resources> elements from the manifest. The -ReferencePath option of eventRegister.exe does not solve the problem because it works by adding a handler for the AppDomain.ReflectionOnlyAssemblyResolve event and ResourceManager does not use reflection-only loads. Workaround: Add a custom target that copies the satellite assemblies to subdirectories of the directory that contains eventRegister.exe.
- The CreateEtwManifestsAndRegDllsCore target in Microsoft.Diagnostics.Tracing.EventRegister.targets has Inputs="$(AssmName)" and does not declare any dependency on satellite assemblies. If I edit only *.resx files and build the project, then Visual Studio compiles only the satellite assemblies and not the main assembly, and it skips the CreateEtwManifestsAndRegDllsCore target because the output files are already newer than the main assembly. The *.dll and *.man files generated by this target will then not contain the updated translations from the *.resx files. Workaround: Before building the project, touch some source file that is compiled to the main assembly.
- When I add parameters to an event that was already defined in a previous version of the software, I'd like to keep the original definition as well, so that Event Viewer can still format the events logged by the previous version. To do that, I'd define another method with the same eventId but a higher EventAttribute.Version, and perhaps rename the original method so that the localization resources don't clash. However, if I try that, then eventRegister.exe fails and says the event ID is already in use.
- If I define multiple events with the same Task and the same Opcode, then eventRegister.exe fails ("Event a (with ID b) has the same task/opcode pair as event c (with ID d)"). Why this restriction?
- There seems to be no way to define task-specific opcodes, so all opcodes consume the same 8-bit space.
- There seems to be no way to specify an OutputType (e.g. win:Win32Error) for a parameter of an event.
- There is a good error message "a property insert in the event message is referencing a non-existent property" if I specify e.g. "{9}" in EventAttribute.Message and the method does not have that many parameters. However, if I make the same mistake in the resources to which EventSourceAttribute.LocalizationResources refer, then there is no warning. I think errors in the *.resx files are even more likely than in the *.cs file, because the list of parameters is not immediately visible.
- When an event has many parameters, it is difficult to verify that all the "{number}" placeholders refer to the correct parameters. Because they get converted to "%number" at build time anyway, it might make sense to allow "{parameterName}"
as well, both in EventAttribute.Message and in resource files.