File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/Authoring/WinRT.SourceGenerator Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,22 @@ public static void GenerateWinRTExportsType(GeneratorExecutionContext context)
292
292
return ;
293
293
}
294
294
295
+ // Make sure to escape invalid characters for namespace names.
296
+ // See ECMA 335, II.6.2 and II.5.2/3.
297
+ if ( assemblyName . AsSpan ( ) . IndexOfAny ( "$@`?" . AsSpan ( ) ) != - 1 )
298
+ {
299
+ char [ ] buffer = new char [ assemblyName . Length ] ;
300
+
301
+ for ( int i = 0 ; i < assemblyName . Length ; i ++ )
302
+ {
303
+ buffer [ i ] = assemblyName [ i ] is '$' or '@' or '`' or '?'
304
+ ? '_'
305
+ : assemblyName [ i ] ;
306
+ }
307
+
308
+ assemblyName = new string ( buffer ) ;
309
+ }
310
+
295
311
context . AddSource ( "ExportsType.g.cs" , $$ """
296
312
// <auto-generated/>
297
313
#pragma warning disable
You can’t perform that action at this time.
0 commit comments