daddoon / blazor.polyfill Goto Github PK
View Code? Open in Web Editor NEWBlazor server-side Polyfills and fixes for Internet Explorer 11 & Edge Legacy
License: MIT License
Blazor server-side Polyfills and fixes for Internet Explorer 11 & Edge Legacy
License: MIT License
With the current release 3.0.8 for .NET Core 3.1 I'm getting this error in IE11.
SCRIPT5078: Cannot redefine non-configurable property "find"
es.symbol.js (266,1)
Could help here?
Thanks
Have you considered publishing the library on npm? This would offer (for the consumers) the ability to keep it up to date, and keep compiled/minified code out of the repository.
Getting this error on several of my blazor apps in IE when I add polyfill.
Microsoft.JSInterop.JSException: 'require' is undefined ReferenceError: 'require' is undefined at Anonymous function (https://localhost:44397/_framework/blazor.server.js:1:70657) at Anonymous function (https://localhost:44397/_framework/blazor.polyfill.min.js:1:87998) at n (https://localhost:44397/_framework/blazor.polyfill.min.js:1:91125) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at Syncfusion.Blazor.Internal.SfBaseUtils.ImportModule(IJSRuntime jsRuntime, SfScriptModules scriptModule, String hashKey) at Syncfusion.Blazor.SfBaseComponent.OnAfterRenderAsync(Boolean firstRender) at Syncfusion.Blazor.Inputs.Internal.SfInputBase.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'QoJeYvM-oc9iEWSruAZKaaJWyvK7omA1p4Ze0CDQMSE'.
Can you provide a licence description, please?
As a suggestion for the README: alternatively to the client side conditional <script> as mentioned in the INSTALLATION section, the server could do it:
@{
// IE11 compatibility
if (Request.Headers.TryGetValue("User-Agent", out var userAgents)
&& (userAgents.FirstOrDefault() is string userAgent)
&& System.Text.RegularExpressions.Regex.IsMatch(userAgent, @"MSIE \d|Trident.*rv:"))
{
<script src="js/blazor.polyfill.min.js"></script>
}
}
Hi, just wanted to let you know that the polyfill is not working with the current preview in Blazor Server on IE11.
Errors from the Console:
Error: Failed to complete negotiation with the server: ReferenceError: 'AbortController' is undefined
Error: Failed to start the connection: ReferenceError: 'AbortController' is undefined
I tried adding AbortController from polyfill.io but then the next set of errors appears:
Error: There was an error applying batch 2.
Error: There is no browser renderer with ID 0
Hopefully it will be possible to have some support for IE11 in 5.0 too.
Thanks!
I am using client side i desperately need to run my application on IE 11
Hi,
"forEach" polyfills are missing for MatBlazor components (RadioButton). Simmilar issue as for Telerik. Could be mentioned somewhere?
These additional polyfills seams to solve the issue with MatBlazor.MatRadioGroup / MatRadioButton:
https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.forEach%2CNodeList.prototype.forEach
Thanks for your work,
D
Hello Guillaume!
Thanks for the update regarding .net 5, I have just try yesterday with my project with the new version, it does work in my development environment with ie 11. After I published to the Azure Webapps it does not work anymore. do you have any suggestions? thanks a lot.
Buttons does not call c# code when clicked when using version 6.0.200 on Microsoft Surface RT.
If i downgrade to version 6.0.100.3 the button works as expected and is calling the c# code.
There is currently no null check in Blazor.Polyfill.Server.HttpRequestExtensions.IsInternetExplorer(string userAgent)
.
We found that out the hard way after health checks from HA Proxy reported the application was down. This was because HA Proxy sends a HEAD request that does not have a User-Agent header by default.
If you want, I can submit a PR for this.
.NET SDK - 5.0.100-preview.7.20366.6
Visual Studio - 16.7.0 Preview 5.0
We can reproduce it with default counter component by clicking it count value will not be updated.
Could you downgrade from .net 5 or at least make it possible to run .net core 3.1 ..
I just downloaded the solution and am trying to build it cuz changing the framework version just to support IE11 seems a bit drastic.
Hello, could you also please add Chrome & Firefox support as they also don't understand ES6, then your library would be just perfect !!! Many thanks, Raphaël
Hi,
there is an issue when the base url is set in HTML head of the Blazor app:
<base href="/SomePath/" />
You have to change function blazorPolyFill
on line 3500 to append the location.pathname
by creating the document.baseURI
.
For IE11, it's ok to set document.baseURI = location.href
.
Regards
Sven
Just to let you know this doesn't work anymore with the latest Preview 4. As far as I can see there're no errors in the IE11 console. I'd love to help but I have pretty basic JS knowledge.
Regards
I get the error
when running the default project in .NET 5 RC1.
This is the line:
The error occurs at the import(e) function.
I think this is caused by the new JSObjectReference feature.
Update:
I have a workaround.
If you add these lines into the top of _Host.cshtml
'''
@using System.IO
@using System.Reflection
'''
And these to the top of the body of _Host.cshtml:
@{
var assembly = Assembly.Load("Microsoft.AspNetCore.Components.Server");
var resources = assembly.GetManifestResourceNames();
var resourceName = resources .Single(str => str.EndsWith("blazor.server.js"));
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string js = reader.ReadToEnd();
js = js.Remove(67710, 140);
js = js.Replace(@"/\W*Blazor:[^{]*(?<descriptor>.*)$/", @"/\W*Blazor:[^{]*(.*)$/");
js = js.Replace(@"r.groups&&r.groups.descriptor", @"r[1]");
System.IO.File.WriteAllText(System.IO.Path.Combine("wwwroot", "js", "blazor.server.js"), js);
}
}
Then change the line
<script src="_framework/blazor.server.js"></script>
to
<script src="js/blazor.server.js"></script>
This gets the file from the assembly, edits it to remove the offending line, changes a regex group name to indexed groups and saves it locally.
Is this something that can be put into the library?
Hi.
Thank you for Blazor.Polyfill.
It seems Blazor.Polyfill doesn't explicitly support the scenario where Blazor is configured to start manually.
For example,
<script type="text/javascript">
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
document.write('<script src="@Url.Content("~/lib/blazor.polyfill/blazor.polyfill.min.js")"><\/script>');
}
</script>
<script src="~/_framework/blazor.server.js" autostart="false"></script>
<script>
Blazor.start({
configureSignalR: function (builder) {
@{
<environment include="Development">
builder.configureLogging("debug");
</environment>
}
builder.withUrl("@Url.Content("~/_blazor")");
}
});
</script>
Sometimes, this works fine, but other times I get the following error in the browser console:
Unhandled promise rejection Error: Blazor has already started.
Blazor.Polyfill seems to always force starting on IE:
https://github.com/Daddoon/Blazor.Polyfill/blob/master/src/Daddoon.Blazor.Polyfill.JS/src/Boot.ts#L90
Is this something that has to be explicitly implemented in Blazor.Polyfill, or is there a work-around for this issue?
I'm using Visual Studio 2019, ASP.NET Core 3.1, Blazor Server, blazor.polyfill 3.0.8, Windows 10, and IE11.
Thank you.
Is this correct, you have 2 includes of the same file
`<script type="text/javascript">
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
document.write('<script src="js/blazor.polyfill.min.js"></script>');
}
</script>
<script type="text/javascript" src="blazor.polyfill.min.js"></script>
Fix current Dependabot alerts of Github on the project for the next release.
Updates are surely blocked by Webpack that should be updated i guess.
Thanks for this project!
I've tried dropping it into a Blazor project and then running that in Safari (Release 59 (Safari 12.0, WebKit 13606.1.21)
), but while that makes it no longer crash, it does fail. The console says:
[Log] Buggy webkit detected (blazor.polyfill.min.js, line 1)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (mono.js.mem, line 0)
[Warning] a problem seems to have happened with Module.memoryInitializerRequest, status: 404, retrying mono.js.mem (mono.js, line 1)
[Error] abort(). Build with -s ASSERTIONS=1 for more info.
abort (mono.js:1:173897)
_abort (mono.js:1:138319)
_monoeg_log_default_handler (Anonymous Script 1 (line 195414))
_monoeg_g_logstr (Anonymous Script 1 (line 218690))
_monoeg_g_logv_nofree (Anonymous Script 1 (line 208543))
_monoeg_g_logv (Anonymous Script 1 (line 226212))
_monoeg_g_log (Anonymous Script 1 (line 218160))
_monoeg_g_calloc (Anonymous Script 1 (line 191176))
_monoeg_malloc0 (Anonymous Script 1 (line 234893))
_monoeg_g_hash_table_new (Anonymous Script 1 (line 198590))
_mono_aot_init (Anonymous Script 1 (line 198421))
_mini_init (Anonymous Script 1 (line 73657))
_mono_jit_init_version (Anonymous Script 1 (line 236047))
_mono_wasm_load_runtime (Anonymous Script 1 (line 192015))
ccall (mono.js:1:5657)
(anonymous function) (mono.js:1:6038)
(anonymous function) (blazor.js:760)
callRuntimeCallbacks (mono.js:1:15864)
postRun (mono.js:1:16904)
doRun (mono.js:1:173110)
run (mono.js:1:173269)
runCaller (mono.js:1:172712)
removeRunDependency (mono.js:1:18358)
finish (mono.js:1:92410)
processData (mono.js:1:92676)
(anonymous function) (mono.js:1:92789)
xhr_onload (blazor.js:772)
It seems I need to ship an additional file, but I'm not sure from where?
I am using InvokeVoidAsync on a windows machine in IE 11 to call a javascript method that is in _host. It works on chrome but in IE 11 with the Polyfill setup in startup.cs I get the below error in the c# code. I am not using BlazorPolyfill.Build as I don't need module support so it did not seem relevant.
The javascript is
window.PlayAudioFile = (src) => { var sound = document.createElement('audio'); sound.src = src; sound.type = 'audio/mpeg'; document.body.appendChild(sound); sound.load(); sound.play(); }
I call it with await js.InvokeVoidAsync("PlayAudioFile", fullFileName);
----Error ---
Microsoft.JSInterop.JSException
HResult=0x80131500
Message=Could not find 'PlayAudioFile' ('PlayAudioFile' was undefined).
Error: Could not find 'PlayAudioFile' ('PlayAudioFile' was undefined).
at Anonymous function (http://localhost:55722/_framework/blazor.server.js:1:69862)
at Anonymous function (http://localhost:55722/_framework/blazor.polyfill.min.js:1:4449)
at Anonymous function (http://localhost:55722/_framework/blazor.polyfill.min.js:1:55749)
at n.prototype.findFunction (http://localhost:55722/_framework/blazor.server.js:1:69796)
at l (http://localhost:55722/_framework/blazor.server.js:1:69234)
at Anonymous function (http://localhost:55722/_framework/blazor.server.js:1:71228)
at B (http://localhost:55722/_framework/blazor.polyfill.min.js:1:89252)
at n.jsCallDispatcher.beginInvokeJSFromDotNet (http://localhost:55722/_framework/blazor.server.js:1:71198)
at Anonymous function (http://localhost:55722/_framework/blazor.server.js:1:27300)
at Anonymous function (http://localhost:55722/_framework/blazor.polyfill.min.js:1:4449)
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Runtime.CompilerServices.ValueTaskAwaiter
1.GetResult()
at Microsoft.JSInterop.JSRuntime.d__151.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.ValueTask
1.get_Result()
at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
at Microsoft.JSInterop.JSRuntimeExtensions.d__0.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TinkerButtonBlazor.Pages.ReactionME.d__11.MoveNext() in C:\Users\ngelotte\source\repos\TinkerButton\TinkerButtonBlazor\Pages\ReactionME.razor:line 48
Hi Daddoon
I build a small mapping app based on the vs 2019 (v16.6.1) server template. The map is created using <script src="https://js.arcgis.com/4.12/"></script>
So far this worked fine on clientside Blazor and works also serverside on Chrome and Edge browser (Win10). Unfortunately in IE11 the map is not displayed. Fiddler tells me, that map requests are sent to the mapping server...
My organisation still uses IE11 for many Intranet business applications, so before introducing Blazor I must have at least a basic support for IE11
Could you please have a look at this issue, hope this is a small problem. Please tell me, if you need some additional information, the VS solutiont etc.
Thank you very much.
Best Regards
Bernd Nierula
Legacy Edge support for server-side
I am trying to run the blazor Polyfill on .net 5 in a docker container on a Raspberry Pi. But it just crashes below is the app starting up and then one initial request.
Is there a way to maybe generate the javascript in VS and then package it with the app as libChakraCore.so is not available for Arm?
`Name or service not known
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
Name or service not known
Name or service not known
Name or service not known
Name or service not known
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
React.Exceptions.BabelException: Unable to resolve type: React.ReactEnvironment
---> React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.ReactEnvironment
---> React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.JavaScriptEngineFactory
---> JavaScriptEngineSwitcher.Core.JsEngineLoadException: Failed to create instance of the ChakraCoreJsEngine. Most likely it happened, because the 'libChakraCore.so' assembly or one of its dependencies was not found. There is no JavaScriptEngineSwitcher.ChakraCore.Native.linux-* package for the arm processor architecture. You can build the 'libChakraCore.so' assembly for the current processor architecture by using following instructions from official repository - https://github.com/Microsoft/ChakraCore/wiki/Building-ChakraCore#linux.
Engine name: ChakraCoreJsEngine
Engine version: 1.11.24
Category: Engine load error
Description: Most likely it happened, because the 'libChakraCore.so' assembly or one of its dependencies was not found. There is no JavaScriptEngineSwitcher.ChakraCore.Native.linux-* package for the arm processor architecture. You can build the 'libChakraCore.so' assembly for the current processor architecture by using following instructions from official repository - https://github.com/Microsoft/ChakraCore/wiki/Building-ChakraCore#linux. ---> System.DllNotFoundException: Unable to load shared library 'ChakraCore' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libChakraCore: cannot open shared object file: No such file or directory
at JavaScriptEngineSwitcher.ChakraCore.JsRt.NativeMethods.JsCreateRuntime(JsRuntimeAttributes attributes, JsThreadServiceCallback threadService, JsRuntime& runtime)
at JavaScriptEngineSwitcher.ChakraCore.JsRt.JsRuntime.Create(JsRuntimeAttributes attributes, JsThreadServiceCallback threadServiceCallback)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.<>c__DisplayClass10_0.<.ctor>b__0()
at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.ScriptTaskWithoutResult.Run()
--- End of stack trace from previous location ---
at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.Invoke(Action action)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine..ctor(ChakraCoreSettings settings)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine..ctor(ChakraCoreSettings settings)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngineFactory.CreateEngine()
at JSPool.JsPool`2.CreateEngine()
at JSPool.JsPool`2.PopulateEngines()
at JSPool.JsPool`2..ctor(JsPoolConfig`1 config)
at JSPool.JsPool..ctor(JsPoolConfig config)
at React.JavaScriptEngineFactory.CreatePool()
at React.JavaScriptEngineFactory..ctor(IJsEngineSwitcher jsEngineSwitcher, IReactSiteConfiguration config, ICache cache, IFileSystem fileSystem)
at lambda_method52(Closure , Object[] )
at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
--- End of inner exception stack trace ---
at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
--- End of inner exception stack trace ---
at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.CustomObjectLifetimeFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.Resolve(Type resolveType)
at React.TinyIoC.TinyIoCContainer.Resolve[ResolveType]()
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.Transform(String input, String filename, String babelrcJSON)
--- End of inner exception stack trace ---
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.Transform(String input, String filename, String babelrcJSON)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.GetPatchedBlazorServerFile()
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.CacheBlazorPolyfillLib()
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.<>c.<UseBlazorPolyfill>b__7_0(HttpContext context, Func`1 next)
at Microsoft.AspNetCore.Builder.UseExtensions.<>c__DisplayClass0_1.<Use>b__1(HttpContext context)
at React.AspNet.BabelFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
Name or service not known
`
Just a reminder for next release:
IE11: Fix "_reconnectcallback" undefined
Hi, we use the Telerik Calendar control which works fine with the polyfill but the DatePicker throws an error. Any idea what the error could be? Here's a link to the telerik-blazor.js.
[2019-11-25T10:16:17.594Z] Error: Microsoft.JSInterop.JSException: Object doesn't support this action
TypeError: Object doesn't support this action
at value (https://localhost:44377/_content/telerik.ui.for.blazor/js/telerik-blazor.js:37:8083)
at value (https://localhost:44377/_content/telerik.ui.for.blazor/js/telerik-blazor.js:37:7870)
at e (https://localhost:44377/_content/telerik.ui.for.blazor/js/telerik-blazor.js:37:4215)
at r (https://localhost:44377/_content/telerik.ui.for.blazor/js/telerik-blazor.js:1:5739)
at o (https://localhost:44377/_content/telerik.ui.for.blazor/js/telerik-blazor.js:37:2442)
at Anonymous function (https://localhost:44377/_framework/blazor.server.js:8:28731)
at Promise (https://localhost:44377/js/blazor.polyfill.js:8904:7)
at e.jsCallDispatcher.beginInvokeJSFromDotNet (https://localhost:44377/_framework/blazor.server.js:8:28701)
at Anonymous function (https://localhost:44377/_framework/blazor.server.js:1:19139)
at e.prototype.invokeClientMethod (https:/
Unfortunately it looks like the polyfill does not work after upgrading a project to .NET 6.
The error messages when trying to run under .NET 6 are:
React.Exceptions.BabelException: Error: /blazor.server.js: Expected atom at position 3
^\s*Blazor-Co
^
at a (React.Core.Resources.babel.generated.min.js:1:1608241) -> …tion(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e
---> JavaScriptEngineSwitcher.Core.JsRuntimeException: Error: /blazor.server.js: Expected atom at position 3
^\s*Blazor-Co
^
at a (React.Core.Resources.babel.generated.min.js:1:1608241) -> …tion(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e
Engine name: ChakraCoreJsEngine
Engine version: 1.11.24
Category: Runtime error
Description: /blazor.server.js: Expected atom at position 3
^\s*Blazor-Co
^
Type: Error
Document name: React.Core.Resources.babel.generated.min.js
Line number: 1
Column number: 1608241
Source fragment: …tion(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e
Call stack:
at a (React.Core.Resources.babel.generated.min.js:1:1608241) ---> JavaScriptEngineSwitcher.ChakraCore.JsRt.JsScriptException: Script threw an exception.
at JavaScriptEngineSwitcher.ChakraCore.JsRt.JsErrorHelpers.ThrowIfError(JsErrorCode errorCode)
at JavaScriptEngineSwitcher.ChakraCore.JsRt.JsValue.CallFunction(JsValue[] arguments)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.<>c__DisplayClass27_0.<InnerCallFunction>b__0()
at React.ReactEnvironment.ExecuteWithBabel[T](String function, Object[] args)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.Transform(String input, String filename, String babelrcJSON)
--- End of inner exception stack trace ---
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.Transform(String input, String filename, String babelrcJSON)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.GetPatchedBlazorServerFile()
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.CacheBlazorPolyfillLib()
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.<>c.<UseBlazorPolyfill>b__10_0(HttpContext context, Func`1 next)
at Microsoft.AspNetCore.Builder.UseExtensions.<>c__DisplayClass0_1.<Use>b__1(HttpContext context)
at React.AspNet.BabelFileMiddleware.Invoke(HttpContext context)
at LotteryPost.StatusCodeExceptionHandler.InvokeAsync(HttpContext context) in C:\Development\Web Project\Lottery Post\Lottery Post\Class\StatusCodeException.cs:line 29
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.ExecuteWithFilterAsync(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext)
at Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
In my scenario, I need to get the innerHTML value of an contenteditable element
My sample parent element contains an IMG tag element as a child.
specific button clicks action I need to get the parent element innerHTML property value. while doing this action getting below highlighted console error in a console window
Facing issue in Blazor Server app with contenteditable div element
any workaround to avoid this error logs ?
I have issue sending datetime-local from client to server
getting this error only if I dont step-by-step in debugger
SCRIPT5022: Invalid element type 'text'.
Code:
var datetime = moment($("#" + prop + "[type=datetime-local]").val(), "DD/MM/YYYY HH:mm").toDate();
if (!isNaN(datetime))
ref.invokeMethodAsync("SetDate", new Date(datetime.setHours(datetime.getHours() + 1)), prop);
Any idea what's wrong?
Firstly, thankyou for setting this up on npm, this will make it easier to monitor and maintain updates through the libman.json. One request though, could the npm release include the unminified version in addition to the already provided minified version of the script file? I know for myself and my organisation, its generally preferred to use unminified versions on Development environments.
There appears to be an issue when uploading files using the tag. The upload works fine in Chrome, but fails in MSIE11. The reported error is:
Unhandled exception at line 8, column 69303 in http:///_framework/blazor.server.js
0x800a1389 - JavaScript runtime error: Number expected
It seems there are some changes in a blazor.server.js file from ASP,NET Core 8 which make old React.AspNet Babel crash during transpiling.
[ERR] : 2024-04-16T17:52:52.5005896+03:00 | 0HN2U4JDPFO6R:00000001 | On path '/_framework/blazor.server.js' - [Events success status] BeforeTransform: True, Transform: False, BeforeMinification: True, Minification: True
Error Message: Error: /blazor.server.js: Expected atom at position 3
^\s*Blazor-Se
^
at a (React.Core.Resources.babel.generated.min.js:1:1608241) -> …….
Consider exception analysis with 'BlazorPolyfillOptions.OnES5ConvertFailure' method and prior code fixing before transform through 'BlazorPolyfillOptions.BeforeES5TransformHandler'
Try to implement a polyfill for Navigator.sendBeacon missing on IE11
It looks like the transpiled version of blazor.server.js is stored in a private static variable, so every time the application restarts (for example, when the IIS app pool is restarted), the transpiled version of blazor.server.js has to be recreated using Babel.
That adds around 4-5 seconds to the app startup time, which for a high-volume production site can be a long time.
In reality, blazor.server.js gets updated infrequently, so if the transpiled version were cached in the file system, it would be very rare for that 4-5 second recreate time to be needed.
Maybe two files could be stored -- (1) the transpiled (and minified) version of blazor.server.js, and (2) a file just containing the hash of the original blazor.server.js, in order to detect when the source file has been changed.
What do you think?
I have an existing ASP.NET MVC and I try to use my blazor component as follow:
@(await Html.RenderComponentAsync<MyComponent>(RenderMode.Server))
And it seems that polyfill doesn't work with this case. I mean, I cannot call any method within the component (like clicking Save button and calling an API). With ServerPrerendered the oninitialize method is call, but there are no interaction.
Is there any special configuration for that type of solution (MVC + Blazor)? I use default settings with UseBlazorPolyfill options, but I have tested many configuration and it seems that all of this doesn't work.
when I update blazor 0.5.0. then this js not work. how to fix it ? please
Firstly, thank you for this awesome library, without it I wouldn't be able to use Blazor!
I am getting a NullReferenceException
on start up when running more than one unit test using Microsoft.VisualStudio.TestTools.UnitTesting.WebApplicationFactory
. I have created a minimal reproduction (just the Blazor Server template with Blazor.Polyfill and a test project added) of the issue here, just run all the tests (there are only 2) at once and you should get the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at React.AspNet.HttpContextLifetimeProvider.get_Registrations()
at React.AspNet.HttpContextLifetimeProvider.ReleaseObject()
at React.TinyIoC.TinyIoCContainer.CustomObjectLifetimeFactory.Dispose()
at React.TinyIoC.SafeDictionary2.set_Item(TKey key, TValue value) at React.TinyIoC.TinyIoCContainer.AddUpdateRegistration(TypeRegistration typeRegistration, ObjectFactoryBase factory) at React.TinyIoC.TinyIoCContainer.RegisterInternal(Type registerType, String name, ObjectFactoryBase factory) at React.TinyIoC.TinyIoCContainer.Register(Type registerType, Type registerImplementation) at React.TinyIoC.TinyIoCContainer.Register[RegisterType,RegisterImplementation]() at React.AssemblyRegistration.Register(TinyIoCContainer container) at React.Initializer.InitializeIoC(Func
2 requestLifetimeRegistration)
at React.Initializer.Initialize(Func2 requestLifetimeRegistration) at React.AspNet.ReactBuilderExtensions.UseReact(IApplicationBuilder app, Action
1 configure, BabelFileOptions fileOptions)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.InitReact(IApplicationBuilder builder)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.UseBlazorPolyfill(IApplicationBuilder builder, BlazorPolyfillOptions options)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.UseBlazorPolyfill(IApplicationBuilder builder, Action`1 configureOptions)
at Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.UseBlazorPolyfill(IApplicationBuilder builder)
at Blazor.Polyfill.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in C:\Users\BenMiller\Downloads\Blazor.Polyfill\Blazor.Polyfill\Startup.cs:line 51
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.b__1(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Rather confusingly I named my project Blazor.Polyfill
so it's not abundantly clear in the stack trace above, but my call to add your middleware with Blazor.Polyfill.Server.BlazorPolyfillMiddlewareExtensions.UseBlazorPolyfill(IApplicationBuilder builder)
is the (slightly) bold line above.
My tests all pass when I run them one at a time, and I have turned off the option to run tests in parallel, but if I try running more than one test at a time I get the exception above.
Do you have any ideas?
I have fixed an issue with my reproduction project, I messed up when adding to source control and excluded the test project
When running Blazor (Server-side) with Blazor.Polyfill.js in browser Internet Explorer 11
<script src="blazor.polyfill.min.js"></script>
<script src="_framework/blazor.server.js"></script>
attached, I get these errors:
Information: Normalizing '_blazor' to 'http://localhost:20183/_blazor'.
Information: WebSocket connected to ws://localhost:20183/_blazor?id=87ybIVTPb7Vwq3Ui4qNpkw
Information: Using HubProtocol 'messagepack'.
Error: Error parsing handshake response: TypeError: Object doesn't support property or method 'indexOf'
SCRIPT5022: Error parsing handshake response: TypeError: Object doesn't support property or method 'indexOf'
blazor.server.js (16,10932)
Error: Connection disconnected with error 'Error: Error parsing handshake response: TypeError: Object doesn't support property or method 'indexOf''.
Is it possible to fix it in some way?
Now the user the web service is running must have write permissions on 'wwwroot' folder, it would be great if one can specify some temp folder for this purpose.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.