Base solution for your next web application

Activities of "kfrancis"

We have been trying to use notifications but we're getting SQL timeouts because I gather we're abusing notifications so we'd like to use EventBus but it doesn't look like events triggered on the server can be observed client side, is that correct?

We essentially have a background job that is gathering information from a very slow API and we'd like to continue to notify the user when actions are still occurring, but not using IAppNotifier (as it causes the DB timeout issues).

We are thinking about using a SignalR hub that can handle IAsyncEventHandler<SuperCoolEvents> and then send a message to the user by user id which then does the abp.event.trigger with the same data.

If it does work, it'd be nice to see this in the system generally - though it sounds like this would only work if SignalR is enabled, not sure how you'd do it otherwise.

After the v12 update, we're getting the following error trying to build the mobile solution:

The type or namespace name 'ApplicationPartAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ApplicationParts' (are you missing an assembly reference?) PatientManagement.Mobile.MAUI (net7.0-android)

\src\PatientManagement.Mobile.MAUI\obj\Debug\net7.0-ios\iossimulator-x64\PatientManagement.Mobile.MAUI.MvcApplicationPartsAssemblyInfo.cs

  • What is your product version? v11.1
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? net6.0

We're in the very end of a process that has required us to get a Privacy Impact Assessment, Threat Risk Assessment, Penetration Test and Vulnerability Scans and there are some items that we can't resolve because they are internal to this project.

1. Page.js contains an insecure version of jquery:

"/saas/js/page.min.js contains jquery 3.4.1 which has known vulnerabilities."

The main site uses 3.6.0 (latest), can page.js use that already correct version?

2. User session timeout does not work propertly:

"The application does not terminate users’ sessions after session timeout; users’ sessions can be resumed without login to the (oauth provider) again."

This might just be configuration, but we're not certain where.

(Using product version 10.5.0 .NET Core MVC)

Getting an error on login following a specific sequence:

  1. User is logged in and opens change password modal,
  2. clicks link to Forgot Password page (is logged out),
  3. clicks Back to exit, is directed to Login page,
  4. and attempts to log in with the correct credentials

Instead of successfully logging in, a 400 bad request response is sent back. Upon closer inspection, an ASP.NET Core antiforgery token is lingering in the cookies and fails the automatic validation applied to the Login controller method.

Adding an IgnoreAntiforgeryToken attribute to the login method is the most obvious solution. Does this interfere with ABP's automatic CSRF validation or will the login form still be protected? Might something else be missing that would prevent this problem altogether?

  • What is your product version? v10.5.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? Net5.0

We've been experiencing some growing pains here and on watching a really informative webinar yesterday (https://blog.jetbrains.com/dotnet/2021/10/08/profiling-and-fixing-common-performance-bottlenecks-webinar-recording) we've tried to start working on some of those anti-patterns we were using (like awaits inside loops).

Now that we've started, however, we're getting the error:

A second operation was started on this context before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext

Here's one such example, the original code:

The modified code:

What are we missing here? We can wrap things in semaphoneslim to correct this (since lock can't have async code inside) but that doesn't "smell" right at all ..

  • What is your product version? 10.3.0 or 10.4.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET Core

If we generate a new demo project today with these settings:

  • ASP.NET CORE MVC & jQuery
  • NET 5
  • 10.4.0 (or 10.3.0)

And attempt to run the Xamarin project in the simulator, following the dev guide, it fails with:

Error processing the method 'System.Void Abp.Auditing.AuditingInterceptor/<InternalInterceptAsynchronous>d__6`1::MoveNext()' in the assembly 'Abp.dll': Value cannot be null.

Looks like it's something related to the linker going wrong.

We're trying to optimize some specific app service layer code, but we're having a hard time getting a console app setup with BenchmarkDotNet to get started. Has anyone setup someting similar that we can take a look at?

We have an app service that's doing quite a bit of manipulation and we're hoping to resolve that app service in the benchmark app so we can compare one method "Evaluate" of the app service to another, like "OptimizedEvaluate".

Prerequisites

  • What is your product version? 10.0.0
  • What is your product type (Angular or MVC)? MVC Jquery
  • What is product framework type (.net framework or .net core)? Net 5

We've developed a system using aspnetzero, works great. We're now down to testing other features that we didn't pay much attention to, like localization. We have a case where a modal popup works fine when the language is English, and fails (model binding with the view model, my guess) when the language is anything but english.

Stack Trace

WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - There are 6 validation errors:
WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - The value '0.2' is not valid. (PrimaryOpacities)
WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - The value '0.2' is not valid. (PrimaryOpacities)
WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - The value '0.2' is not valid. (PrimaryOpacities)
WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - The value '0.2' is not valid. (SecondaryOpacities)
WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - The value '0.2' is not valid. (SecondaryOpacities)
WARN  2020-12-03 15:46:05,850 [64   ] Mvc.ExceptionHandling.AbpExceptionFilter - The value '0.2' is not valid. (SecondaryOpacities)
INFO  2020-12-03 15:46:05,851 [64   ] c.Infrastructure.ControllerActionInvoker - Executed action PatientManagement.Web.Areas.App.Controllers.PatientsController.ViewSegmentModal (PatientManagement.Web.Mvc) in 609.1147ms
INFO  2020-12-03 15:46:05,851 [64   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'PatientManagement.Web.Areas.App.Controllers.PatientsController.ViewSegmentModal (PatientManagement.Web.Mvc)'
ERROR 2020-12-03 15:46:05,852 [64   ] nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
Abp.Runtime.Validation.AbpValidationException: Method arguments are not valid! See ValidationErrors for details.
   at Abp.Runtime.Validation.Interception.MethodInvocationValidator.ThrowValidationError()
   at Abp.Runtime.Validation.Interception.MethodInvocationValidator.Validate()
   at Abp.AspNetCore.Mvc.Validation.AbpValidationActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at StackifyMiddleware.RequestTracerMiddleware.InvokeAsync(HttpContext context)
   at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware`1.InvokeAsync(HttpContext context) in /_/src/Transports.AspNetCore/GraphQLHttpMiddleware.cs:line 50
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 121
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)
   at IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.&lt;&gt;c__DisplayClass0_0.&lt;&lt;UseJwtTokenMiddleware&gt;b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.&lt;&gt;c__DisplayClass0_0.&lt;&lt;UseJwtTokenMiddleware&gt;b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
INFO  2020-12-03 15:46:05,915 [12   ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/1.1 POST http://localhost:63114/App/Patients/ViewSegmentModal application/x-www-form-urlencoded;+charset=UTF-8 434 - 500 - text/html;+charset=utf-8 685.3018ms

I know it says there are model violations, but it doesn't necessarily make sense here.

Here's the english XHR request:

Heres the french XHR request:

The view model is pretty simple:

public class SegmentModalViewModel 
{
     // other fields
     public double[] PrimaryOpacities { get; set; }
     public double[] SecondaryOpacities { get; set; }
}

So, I know that Telerik Reporting has been asked about here before but I'm so close and I just need a nudge. For some unknown reason, Telerik doesn't have the ability to have a Net Core reporting project (something to do with System.Drawing) but you can create a .NET 4.8 project, add the reports and then view those reports from a Net Core 3.1 app. I have that all working. My problem now is DI.

The Core project is Net Core, the Application project is Net Core but the reporting project can only reference NetStandard.

I do have a module for the reporting project that the Mvc then depends on, the report is correctly being resolved using IocManager:

/// <summary>
/// See https://docs.telerik.com/reporting/knowledge-base/how-to-inject-custom-dependency-in-reports-controller-of-dot-net-core-application
/// </summary>
/// <param name="report"></param>
/// <param name="operationOrigin"></param>
/// <param name="currentParameterValues"></param>
/// <returns></returns>
public ReportSource Resolve(string report, OperationOrigin operationOrigin, IDictionary<string, object> currentParameterValues)
{
    var reportType = Type.GetType(report);

    if (reportType == null) throw new UserFriendlyException($"Could not find a corresponding report for type '{report}'.");

    var resolvedReport = (Report)_iocManager.IocContainer.Resolve(reportType);

    var reportSource = new InstanceReportSource { ReportDocument = resolvedReport };

    return reportSource;
}

But, now that I can view the report - how can I get data from the system?

So, what are the possibilities here?

With the last few updates, our team is finding that any change to razor causes the next load of the page to throw an exception. This is causing development to slow way down as we have to build every single time we make small changes.

It should be configured as it always has been and yes, debug constant is on in this context:

services.AddControllersWithViews(options =>
            {
                options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
            })
#if DEBUG
                .AddRazorRuntimeCompilation()
#endif
                .AddNewtonsoftJson();

Raw exception:

System.TypeLoadException: Method 'CommonGetMetadataReference' in type 'Microsoft.CodeAnalysis.CSharp.CSharpCompilation' from assembly 'Microsoft.CodeAnalysis.CSharp, Version=3.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
   at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument)
   at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectEngine.ProcessCore(RazorCodeDocument codeDocument)
   at Microsoft.AspNetCore.Razor.Language.RazorProjectEngine.Process(RazorProjectItem projectItem)
   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.OnCacheMiss(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Razor.Compilation.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.FindView(ActionContext actionContext, ViewResult viewResult)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeResultAsync&gt;g__Logged|21_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResultFilterAsync&gt;g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.&lt;Invoke&gt;g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware`1.InvokeAsync(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 105
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
   at IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Any ideas?

Microsoft.CodeAnalysis.Common was at v3.6.0

Showing 1 to 10 of 12 entries