Skip to content

Commit

Permalink
Fix EncryptionTestAsync on .NET 9 (#3088)
Browse files Browse the repository at this point in the history
* Fix EncryptionTestAsync

* Fix action name.
  • Loading branch information
pmaytak authored Oct 17, 2024
1 parent 4494d84 commit 36e1fd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and run Id Web tests
name: "Id Web GitHub Action Test"

on:
push:
Expand All @@ -17,7 +17,7 @@ jobs:
build:
runs-on: windows-latest
continue-on-error: true
name: IdWeb GitHub Action Test
name: "Id Web GitHub Action Test"
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
Expand Down
9 changes: 3 additions & 6 deletions tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,9 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache)
.GetType()
.GetField("_coherentState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
.GetValue(memoryCache)!;
Type? content1Type = content1?.GetType();
// The internals of CoherentState seem to change between .NET 9 RCs
memoryCacheContent = ((
content1Type?.GetProperty("_entries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) ??
content1Type?.GetProperty("_stringEntries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
)
memoryCacheContent = (content1?
.GetType()
.GetProperty("StringEntriesCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.GetValue(content1) as IDictionary)!;
#else
memoryCacheContent = (memoryCache
Expand Down

0 comments on commit 36e1fd7

Please sign in to comment.