Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .net9 support #156

Merged
merged 3 commits into from
Nov 14, 2024
Merged

Add .net9 support #156

merged 3 commits into from
Nov 14, 2024

Conversation

ScarletKuro
Copy link
Member

Adds .net9 support to TryMudBlazor

@@ -92,7 +91,7 @@ private static IJSInProcessRuntime GetJsRuntime()
throw new MissingMemberException($"Couldn't find type '{defaultJsRuntimeTypeName}'.");
}

var instanceField = defaultJsRuntimeType.GetField(instanceFieldName, BindingFlags.Static | BindingFlags.NonPublic);
var instanceField = defaultJsRuntimeType.GetField(instanceFieldName, BindingFlags.Static | BindingFlags.Public);
Copy link
Member Author

@ScarletKuro ScarletKuro Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now it's public field inside internal, was private before.

@@ -213,7 +213,7 @@ window.Try.CodeExecution = window.Try.CodeExecution || (function () {
const cache = await caches.open('dotnet-resources-/');

const cacheKeys = await cache.keys();
const userComponentsDllCacheKey = cacheKeys.find(x => x.url.indexOf('Try.UserComponents.dll') > -1);
const userComponentsDllCacheKey = cacheKeys.find(x => /Try\.UserComponents\.[^/]*\.dll/.test(x.url));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They changed how it works, now the cacheKeys contains url as

https://localhost:5001/_framework/Try.UserComponents.5js11t3n4f.dll.sha256-sWuk/v/P19Mdwxa9TJKy8H5RCinjfd/iOybI4HtjLRk=

I had to change logic, we cannot use x.url.indexOf('Try.UserComponents') (without .dll prefix) because then it can land on the .pdb file.
This part could lead when click first time on "run" doesn't show any compiled html or throwing the alert message.

Copy link
Member Author

@ScarletKuro ScarletKuro Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can just disable the fingerprints:

<WasmFingerprintAssets>false</WasmFingerprintAssets>

and leave the code as it was before.
This is a very "hidden" switch off, as you won't even find it in the docs, had to look for the runtime sourcecode.

@@ -37,9 +37,6 @@ public partial class Repl : IDisposable
[Inject]
public IJSInProcessRuntime JsRuntime { get; set; }

[Inject]
public IJSUnmarshalledRuntime UnmarshalledJsRuntime { get; set; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IJSUnmarshalledRuntime was removed completely, and it wasn't actually used in the code anymore anyway.

@ScarletKuro
Copy link
Member Author

ScarletKuro commented Nov 12, 2024

Feel free to test this branch if anyone wants to do extensive testing.

@mikes-gh
Copy link

Tested on several code samples including those that use the periodic table API.
Did notice some caching issues between versions of try as discussed. I don't think this is a new problem, however.

@mikes-gh
Copy link

Thanks @ScarletKuro

@mikes-gh mikes-gh merged commit 38722e9 into MudBlazor:main Nov 14, 2024
3 checks passed
@ScarletKuro ScarletKuro deleted the net9 branch November 14, 2024 21:46
ScarletKuro added a commit to ScarletKuro/TryMudBlazor that referenced this pull request Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants