@@ -36,22 +36,14 @@ public abstract class DevToolsDomains
3636 // This is the list of known supported DevTools version implementation.
3737 // When new versions are implemented for support, new types must be
3838 // added to this dictionary.
39- private static readonly Dictionary < int , DomainType > SupportedDevToolsVersions = new Dictionary < int , DomainType > ( )
39+ private static readonly Dictionary < int , Type > SupportedDevToolsVersions = new Dictionary < int , Type > ( )
4040 {
41- { 130 , new DomainType ( typeof ( V130 . V130Domains ) ) } ,
42- { 129 , new DomainType ( typeof ( V129 . V129Domains ) ) } ,
43- { 128 , new DomainType ( typeof ( V128 . V128Domains ) ) } ,
44- { 85 , new DomainType ( typeof ( V85 . V85Domains ) ) }
41+ { 130 , typeof ( V130 . V130Domains ) } ,
42+ { 129 , typeof ( V129 . V129Domains ) } ,
43+ { 128 , typeof ( V128 . V128Domains ) } ,
44+ { 85 , typeof ( V85 . V85Domains ) }
4545 } ;
4646
47- /// <summary>Workaround for trimming.</summary>
48- private readonly struct DomainType
49- {
50- [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ]
51- public readonly Type Type ;
52-
53- public DomainType ( [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors ) ] Type t ) => Type = t ;
54- }
5547 /// <summary>
5648 /// Gets the version-specific domains for the DevTools session. This value must be cast to a version specific type to be at all useful.
5749 /// </summary>
@@ -117,9 +109,9 @@ public static DevToolsDomains InitializeDomains(int protocolVersion, DevToolsSes
117109 private static Type MatchDomainsVersion ( int desiredVersion , int versionRange )
118110 {
119111 // Return fast on an exact match
120- if ( SupportedDevToolsVersions . TryGetValue ( desiredVersion , out DomainType type ) )
112+ if ( SupportedDevToolsVersions . ContainsKey ( desiredVersion ) )
121113 {
122- return type . Type ;
114+ return SupportedDevToolsVersions [ desiredVersion ] ;
123115 }
124116
125117 // Get the list of supported versions and sort descending
@@ -133,7 +125,7 @@ private static Type MatchDomainsVersion(int desiredVersion, int versionRange)
133125 // (that is, closest without going over).
134126 if ( desiredVersion >= supportedVersion && desiredVersion - supportedVersion < versionRange )
135127 {
136- return SupportedDevToolsVersions [ supportedVersion ] . Type ;
128+ return SupportedDevToolsVersions [ supportedVersion ] ;
137129 }
138130 }
139131
0 commit comments