Commit 6c54ede
authored
Change TypeMapLazyDictionary to use direct cast instead of 'as' operator for RuntimeAssembly (#122885)
Replaced `as RuntimeAssembly` with direct cast `(RuntimeAssembly?)` in
`TypeMapLazyDictionary.CreateMaps()` for both `Assembly.Load()` and
`Assembly.GetEntryAssembly()` calls.
Direct cast surfaces type mismatches as `InvalidCastException` rather
than silently returning null, which is the correct behavior since these
methods should always return `RuntimeAssembly` when non-null in the
runtime environment.1 parent 6707b81 commit 6c54ede
1 file changed
Lines changed: 2 additions & 2 deletions
File tree
- src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
0 commit comments