@@ -206,25 +206,18 @@ public PropertiesAccessor([DynamicallyAccessedMembers(LinkerFlags.Component)] Ty
206206
207207 public ( string , Type ) [ ] KeyTypePairs => _cachedKeysForService ;
208208
209- // Mapping for internal classes bundled in different assemblies during prerendering and WASM rendering.
210- private static readonly Dictionary < string , string > _canonicalMap = new ( StringComparer . OrdinalIgnoreCase )
211- {
212- { "Microsoft.AspNetCore.Components.Endpoints" , "Microsoft.AspNetCore.Components" } ,
213- { "Microsoft.AspNetCore.Components.WebAssembly" , "Microsoft.AspNetCore.Components" }
214- } ;
215-
216209 private static string ComputeKey ( Type keyType , string propertyName )
217210 {
218211 // This happens once per type and property combo, so allocations are ok.
219212 var assemblyName = keyType . Assembly . FullName ;
220- var assemblySimpleName = keyType . Assembly . GetName ( ) . Name ?? "" ;
221- if ( _canonicalMap . TryGetValue ( assemblySimpleName , out var canonicalAssembly ) )
222- {
223- assemblyName = canonicalAssembly ;
224- }
225-
226213 var typeName = keyType . FullName ;
227- var inputString = string . Join ( "." , assemblyName , typeName , propertyName ) ;
214+
215+ // Internal classes can be bundled in different assemblies during prerendering and WASM rendering.
216+ bool isTypeInternal = ( ! keyType . IsPublic && ! keyType . IsNested ) || keyType . IsNestedAssembly ;
217+ var inputString = isTypeInternal
218+ ? string . Join ( "." , typeName , propertyName )
219+ : string . Join ( "." , assemblyName , typeName , propertyName ) ;
220+
228221 var input = Encoding . UTF8 . GetBytes ( inputString ) ;
229222 var hash = SHA256 . HashData ( input ) ;
230223 return Convert . ToBase64String ( hash ) ;
0 commit comments