serdarciplak / BlazorMonaco

Blazor component for Microsoft's Monaco Editor which powers Visual Studio Code.
https://serdarciplak.github.io/BlazorMonaco/
MIT License
454 stars 98 forks source link

Error when ConstructionOptions isn't set #43

Closed hjrb closed 1 year ago

hjrb commented 3 years ago

Hello,

when the function reference property "ConstructionOptions" isn't set, one get's an error: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at BlazorMonaco.MonacoEditor.OnAfterRenderAsync(Boolean firstRender)

Maybe this works as designed but a component should not cause a page exception when properties aren't said - right?

serdarciplak commented 1 year ago

Fixed. It will be released v3.0.1

isatahiri commented 1 year ago

Any ETA for the 3.0.1 ?

sfmskywalker commented 1 year ago

@hjrb Thanks for reporting this issue, it helped me figure out the workaround. Admittedly, most users will probably always set this property. For newcomers like myself, however, it's best to not cause a page exception when not setting the ConstructionOptions, but instead, initialise it internally.