GetAssemblyIdentifier in this package strips . and spaces from the assembly name, but not -:
return (compilation.AssemblyName ?? string.Empty)
.Replace(".", string.Empty, StringComparison.Ordinal)
.Replace(" ", string.Empty, StringComparison.Ordinal)
.Trim();
Immediate.Handlers and Immediate.Apis both have the extra - replacement that this copy is missing:
.Replace("-", string.Empty, StringComparison.Ordinal)
Impact
For an assembly named Todo-Web, the four packages disagree:
| Package |
Generated method |
Valid C#? |
| Immediate.Handlers |
AddTodoWebHandlers() |
yes |
| Immediate.Apis |
MapTodoWebEndpoints() |
yes |
| Immediate.Cache |
AddTodo-WebCaches() |
no |
| Immediate.Injections |
AddTodo-WebServices() |
no |
A hyphen is not valid in a C# identifier, so the generated extension method does not compile. Hyphenated assembly names are common (my-app.Web, acme-todo), and the failure is a syntax error inside generated code with no obvious link to the assembly name.
Setting [assembly: ImmediateAssemblyIdentifier("...")] works around it, but only if the user has Immediate.Handlers referenced and works out why they need it.
Fix
Add the - replacement so this matches Immediate.Handlers and Immediate.Apis.
Same issue filed against the other affected package. Found while auditing the packages for the docs site rewrite.
GetAssemblyIdentifierin this package strips.and spaces from the assembly name, but not-:Immediate.Handlers and Immediate.Apis both have the extra
-replacement that this copy is missing:Impact
For an assembly named
Todo-Web, the four packages disagree:AddTodoWebHandlers()MapTodoWebEndpoints()AddTodo-WebCaches()AddTodo-WebServices()A hyphen is not valid in a C# identifier, so the generated extension method does not compile. Hyphenated assembly names are common (
my-app.Web,acme-todo), and the failure is a syntax error inside generated code with no obvious link to the assembly name.Setting
[assembly: ImmediateAssemblyIdentifier("...")]works around it, but only if the user has Immediate.Handlers referenced and works out why they need it.Fix
Add the
-replacement so this matches Immediate.Handlers and Immediate.Apis.Same issue filed against the other affected package. Found while auditing the packages for the docs site rewrite.