Since version 20.2.3 i get the following Exception when running a XAF Blazor UI on Ubuntu Linux 20.04. The Error occurs directly on startup.
Save model changes
TestApp.Blazor.Server Error: 0 : 28.10.20 11:31:40.205 af284899-868c-496f-87f6-116b51d2bbe7 ================================================================================
The error occurred:
Type: PlatformNotSupportedException
Message: Windows Principal functionality is not supported on this platform.
Data: 0 entries
Stack trace:
at System.Security.Principal.WindowsIdentity.GetCurrent()
at DevExpress.ExpressApp.ModelDifferenceDbStore.GetCurrentUserId()
at DevExpress.ExpressApp.ModelDifferenceDbStore.SaveDifference(ModelApplicationBase model)
InnerException is null
Hello Axel,
Would you please attach the whole error callstack with top and inner exceptions (or the log file) so that we can give a precise solution? For more information, please see Collect and Analyze the Diagnostic Information.
At this stage, it looks like you have not used ModelDifferenceDbStore in v20.1 and started to use it in v20.2. Regardless, it looks like an issue in
ModelDifferenceDbStore.GetCurrentUserId()
, which indeed does not handle Linux deployment environments well. There is a way to bypass this behavior by overriding theModelDifferenceDbStore.GetCurrentUserId()
method, but your full call stack will help us see if there are better solutions for this scenario.Hello Dennis,
this is the full call stack:
The error occurred:
Type: UserFriendlyException
Message: Cannot save user settings to the database.
Please refer to the log file for details on the reason for this failure. If you require further assistance, please contact your Administrator.
Windows Principal functionality is not supported on this platform.
Data: 0 entries
Stack trace:
at DevExpress.ExpressApp.ModelDifferenceDbStore.SaveDifference(ModelApplicationBase model)
at DevExpress.ExpressApp.XafApplication.SaveModelChanges()
at DevExpress.ExpressApp.Blazor.BlazorApplication.LogOff()
at DevExpress.ExpressApp.Blazor.Services.XafApplicationProvider.CreateApplication()
at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) --- End of stack trace from previous location where exception was thrown --- at System.Lazy
1.CreateValue()at System.Lazy`1.get_Value()
at DevExpress.ExpressApp.Blazor.Services.XafApplicationProvider.GetApplication()
at DevExpress.ExpressApp.Blazor.Templates.MainPageBase.get_Application()
at DevExpress.ExpressApp.Blazor.Templates.MainPage.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
InnerException is null
Hello Axel,
As a workaround, create the following ModelDifferenceDbStore descendant and use it in your application.
public class CustomModelDifferenceDbStore : ModelDifferenceDbStore { public CustomModelDifferenceDbStore(XafApplication application, Type modelDifferenceType, Boolean isSharedModelDifference) : base(application, modelDifferenceType, isSharedModelDifference) { } public CustomModelDifferenceDbStore(XafApplication application, Type modelDifferenceType, Boolean isSharedModelDifference, String contextId) : base(application, modelDifferenceType, isSharedModelDifference, contextId) { } protected override string GetCurrentUserId() { String result = ""; try { result = base.GetCurrentUserId(); } catch { } return result; } }
Axel, are you using XAF's security system in your Blazor app? If not, you can safely remove any code related to ModelDifferenceDbStore from your solution to avoid this behavior. For more information, see How to: Store the Application Model Differences in the Database. Your complete sample will help us better solutions faster.