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

InputMask exception #3177

Closed
fastlink30 opened this issue Nov 26, 2021 · 16 comments
Closed

InputMask exception #3177

fastlink30 opened this issue Nov 26, 2021 · 16 comments
Assignees
Labels
Type: Bug 🐞 Something isn't working

Comments

@fastlink30
Copy link

fastlink30 commented Nov 26, 2021

with this code:
<InputMask Alias="datetime" InputFormat="dd/mm/yyyy" OutputFormat="ddmmyyyy" />

i get:
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot read property 'toString' of null
TypeError: Cannot read property 'toString' of null
at c (https://localhost:7214/_content/Blazorise/vendors/inputmask.js:8:54579)
at HTMLInputElement.c (https://localhost:7214/_content/Blazorise/vendors/inputmask.js:8:79350)
at de (https://localhost:7214/_framework/blazor.webassembly.js:1:26757)
at ae.tryApplyValueProperty (https://localhost:7214/_framework/blazor.webassembly.js:1:25579)
at ae.tryApplySpecialProperty (https://localhost:7214/_framework/blazor.webassembly.js:1:24580)
at ae.applyEdits (https://localhost:7214/_framework/blazor.webassembly.js:1:21556)
at ae.updateComponent (https://localhost:7214/_framework/blazor.webassembly.js:1:20334)
at https://localhost:7214/_framework/blazor.webassembly.js:1:56876
at Object.St.Te._internal.renderBatch (https://localhost:7214/_framework/blazor.webassembly.js:1:57248)
at Object.Rt [as invokeJSFromDotNet] (https://localhost:7214/_framework/blazor.webassembly.js:1:59934)
Microsoft.JSInterop.JSException: Cannot read property 'toString' of null
TypeError: Cannot read property 'toString' of null
at c (https://localhost:7214/_content/Blazorise/vendors/inputmask.js:8:54579)
at HTMLInputElement.c (https://localhost:7214/_content/Blazorise/vendors/inputmask.js:8:79350)
at de (https://localhost:7214/_framework/blazor.webassembly.js:1:26757)
at ae.tryApplyValueProperty (https://localhost:7214/_framework/blazor.webassembly.js:1:25579)
at ae.tryApplySpecialProperty (https://localhost:7214/_framework/blazor.webassembly.js:1:24580)
at ae.applyEdits (https://localhost:7214/_framework/blazor.webassembly.js:1:21556)
at ae.updateComponent (https://localhost:7214/_framework/blazor.webassembly.js:1:20334)
at https://localhost:7214/_framework/blazor.webassembly.js:1:56876
at Object.St.Te._internal.renderBatch (https://localhost:7214/_framework/blazor.webassembly.js:1:57248)
at Object.Rt [as invokeJSFromDotNet] (https://localhost:7214/_framework/blazor.webassembly.js:1:59934)
at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId)
at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1)
at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
window.Module.s.printErr @ blazor.webassembly.js:1
Te._internal.dotNetCriticalError @ blazor.webassembly.js:1
Rt @ blazor.webassembly.js:1
_mono_wasm_invoke_js_blazor @ dotnet.6.0.0.tj42mwroj7.js:1
(anonymous) @ 00945abe:0x8065b
(anonymous) @ 00945abe:0x689a7
(anonymous) @ 00945abe:0x17bac4
(anonymous) @ 00945abe:0x172bc5
(anonymous) @ 00945abe:0xb47cc
(anonymous) @ 00945abe:0x11875
(anonymous) @ 00945abe:0x15f1e2
(anonymous) @ 00945abe:0x80614
(anonymous) @ 00945abe:0x689a7
(anonymous) @ 00945abe:0x17bac4
(anonymous) @ 00945abe:0x172bc5
(anonymous) @ 00945abe:0xb47cc
(anonymous) @ 00945abe:0x16602
fb @ 00945abe:0x16f60e
Module._mono_wasm_invoke_method @ dotnet.6.0.0.tj42mwroj7.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet @ managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet:19
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
b @ blazor.webassembly.js:1
invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
invokeWhenHeapUnlocked @ blazor.webassembly.js:1
S @ blazor.webassembly.js:1
C @ blazor.webassembly.js:1
dispatchGlobalEventToAllElements @ blazor.webassembly.js:1
onGlobalEvent @ blazor.webassembly.js:1
t.trigger @ inputmask.js:8
blurEvent @ inputmask.js:8
l @ inputmask.js:8
Show 2 more frames
browserLink:2843

To Reproduce
enter component
click/enter another component

Expected behavior
no exception

Note
if i add Value=@aaa as parameter and aaa is not initialized or "" i get exception, if aaa="15122010" nothing happen

blazorise 0.9.5 vs2022 bootstrap 5

@stsrki
Copy link
Collaborator

stsrki commented Nov 26, 2021

I have tried to reproduce it in Chrome, Firefox, and Edge. It works without any errors on my side.

@fastlink30
Copy link
Author

fastlink30 commented Nov 26, 2021

i have done another project, similar and is functional, but at this point i not understand what can be, some dependency? i have removed the dir bootstrap and open-iconic, as writed in the doc for bootstrap5, in the new project and old

@stsrki
Copy link
Collaborator

stsrki commented Nov 29, 2021

So, it is working now?

@fastlink30
Copy link
Author

no, i try to replicate (as much possible) the old project on the test project, but on the test project is functional, is java side of inputmask that make exception, but on test project no, old & test project are on the same computer, so i think is some configuration, i copyed program.cs (are very similar), maynlayout have only the inputmask, removed directory bootstrap & openicon, insert on the test project, the same library from the old, copyed the index.html, changed bootstrap5 to bootstrap, disable authentication, and many other things, but already solution not found, the error is ever the same

@stsrki
Copy link
Collaborator

stsrki commented Nov 29, 2021

Do you have any subdirectory url routing configured on Startup?

@stsrki
Copy link
Collaborator

stsrki commented Nov 29, 2021

PS. I will today release the new 0.9.5.1 with some fixes. Maybe it will help.

@fastlink30
Copy link
Author

fastlink30 commented Nov 29, 2021

sure i try, maybe if i attach the visualstudio-js-debugger file can help?

`WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);

        builder.RootComponents.Add<App>("#app");
        builder.RootComponents.Add<HeadOutlet>("head::after");
        //
        // componenti blazorise.com
        //
        builder.Services
          .AddBlazorise(options => { options.ChangeTextOnKeyPress = false; options.ShowNumericStepButtons = false; })
          .AddBootstrap5Providers()
          .AddFontAwesomeIcons()
          ;
        //
        // log a console
        //
        Log.Logger = new LoggerConfiguration()
            .WriteTo.BrowserConsole()
            .CreateLogger();

setup httpclient && some scoped class

        //
        // state container
        //
        builder.Services.AddScoped<IMainStateContainer, MainStateContainer>();
        //
        //
        //
        var host = builder.Build();

        await host.RunAsync();

@stsrki
Copy link
Collaborator

stsrki commented Nov 29, 2021

It is now released https://blazorise.com/news/release-notes/095-1

Please let us know if it helps.

@fastlink30
Copy link
Author

no, vs 0.9.5.1 not solve the problem... :(
i not have idea what to do more

@fastlink30
Copy link
Author

fastlink30 commented Nov 29, 2021

BlazorApp1.zip
i have prepared quickly this project, so you can test it, i hope on your computer crash also

@stsrki
Copy link
Collaborator

stsrki commented Nov 29, 2021

Working without any issues on my machine.

@stsrki
Copy link
Collaborator

stsrki commented Nov 29, 2021

Can you try Ctrl+F5 once again?

@fastlink30
Copy link
Author

done, same problem, i'm preparing another virtual machine to install only vs2022 and try

@fastlink30
Copy link
Author

nope, also on the new virtual machine, same error, but i not understand why if i do a new project the control goes

@fastlink30
Copy link
Author

i found the problem:

in my program.cs i have this:

builder.Services
.AddBlazorise(options => { options.ChangeTextOnKeyPress = false; options.ShowNumericStepButtons = false; })
.AddBootstrap5Providers()
.AddFontAwesomeIcons()
;

if you put ChangeTextOnKeyPress = true nothing happen if you click outside component after select & enter it!
but if you write all the data value and cancell all, error appear.

i think is some problem with timing

@stsrki
Copy link
Collaborator

stsrki commented Dec 1, 2021

Thank you for investigating this. I have figured it. The problem is that both Blazor and inputmask are using the same input event and they "fight" over it. I will need to see what can be done to fix it.

@stsrki stsrki self-assigned this Dec 1, 2021
@stsrki stsrki added the Type: Bug 🐞 Something isn't working label Dec 1, 2021
@stsrki stsrki added this to the 0.9.5 Support milestone Dec 1, 2021
@stsrki stsrki closed this as completed Dec 1, 2021
@stsrki stsrki added this to Support Aug 3, 2024
@stsrki stsrki moved this to ✔ Done in Support Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐞 Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants