I have written a class whose job is to return the maximum and minimum value of any data typeThis class works fine when debugging the project, but when we publish and run it and enter the part where we use this class, the following error occurs.
crit:microsoft.aspnetcore.components.webassembly.rendering.webassemblyrenderer[100]unhandled exception rendering component: error: no element iscurrently associated with component 250 error: no element is currentlyassociated with component 250
public static class MinMaxDefaultValue<T>{ public static T? Min { get; } public static T? Max { get; } public static T? Step { get; } public static T? Default { get; } public static Type Type { get; } = typeof(T); static MinMaxDefaultValue() { Default = default; if (Default is null) return; var interfaces = Type.GetInterfaces(); if (!interfaces.Any(t => t.GetGenericTypeDefinition() == typeof(INumber<>))) return; Step = (T)Convert.ChangeType(1, Type); Min = GetValue("MinValue"); Max = GetValue("MaxValue"); } public static T? GetValue(string fieldName) { var fieldInfo = Type.GetField(fieldName); if (fieldInfo is null) return default; return (T?)fieldInfo.GetValue(null); }}