[release/7.0][wasm] Correctly escape library names when generating symbols for .c#79175
Conversation
…otnet#79007) * [wasm] Correctly escape library names when generating symbols for .c files. Use the existing `FixupSymbolName` method for fixing library names too, when converting to symbols. * [wasm] *TableGenerator task: Cache the symbol name fixups .. as it is called frequently, and for repeated strings. For a consolewasm template build, we get 490 calls but only 140 of them are for unique strings. * Add tests Fixes dotnet#78992 . (cherry picked from commit 85a9dfc)
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsBackport of #79007 to release/7.0 Customer impactThis allows the use of NuGets containing PInvokes that have Fixes user reported issue - #78992 . TestingNew unit tests added, and since this impacts AOT too, it got tested by all the AOT library tests. RiskLow. It makes the behavior consistent with symbol generation we already had in other places.
|
|
Approved by Tactics for 7.0.3. |
Backport of #79007 to release/7.0
Customer impact
This allows the use of NuGets containing PInvokes that have
-in their name, with WASM projects. Wasm build generates C wrapper code to call such pinvokes, and the symbol names generated in the code did not escape-in the library name.The code now uses a different method to only have alphanumeric characters as-is, and escape/substitute any others with alphanumeric characters.
Fixes user reported issue - #78992 .
Testing
New unit tests added, and since this impacts AOT too, it got tested by all the AOT library tests.
Risk
Low. It makes the behavior consistent with symbol generation we already had in other places.