0
fatih.ozturk created
Prerequisites
- version? v10.3.0
- product type (Angular or MVC)? ASP.NET CORE & Angular
- framework type? .NET 5.0 core
Hello,
I am using automatic audit logging for my inquiries. I am getting "Mvc.ExceptionHandling.AbpExceptionFilter - Sequence contains no elements." error while inserting to "AbpAuditLogs" log table.
Should I change any config to fix the issue? I am using default MsSql DB. Thanks
[Table("TableXYZ")]
[Audited]
public class TableXYZ : AuditedEntity<long>, IMayHaveTenant
WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([t].[TenantId] = @__ef_filter__CurrentTenantId_1)) AND ([t].[TerminalCode] = @__input_TerminalCode_0)
INFO 2021-12-24 10:37:28,862 [57 ] osoft.EntityFrameworkCore.Infrastructure - Entity Framework Core 5.0.3 initialized 'AccessDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
INFO 2021-12-24 10:37:28,869 [13 ] oft.EntityFrameworkCore.Database.Command - Executed DbCommand (4ms) [Parameters=[@p0='?' (Size = 512), @p1='?' (Size = 64), @p2='?' (Size = 128), @p3='?' (Size = 2000), @p4='?' (Size = 2000), @p5='?' (Size = 1024), @p6='?' (DbType = Int32), @p7='?' (DbType = DateTime2), @p8='?' (DbType = Int32), @p9='?' (DbType = Int64), @p10='?' (Size = 256), @p11='?' (Size = 1024), @p12='?' (Size = 4000), @p13='?' (Size = 256), @p14='?' (DbType = Int32), @p15='?' (DbType = Int64)], CommandType='Text', CommandTimeout='30']
SET NOCOUNT ON;
INSERT INTO [AbpAuditLogs] ([BrowserInfo], [ClientIpAddress], [ClientName], [CustomData], [Exception], [ExceptionMessage], [ExecutionDuration], [ExecutionTime], [ImpersonatorTenantId], [ImpersonatorUserId], [MethodName], [Parameters], [ReturnValue], [ServiceName], [TenantId], [UserId])
VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15);
SELECT [Id]
FROM [AbpAuditLogs]
WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();
ERROR 2021-12-24 10:37:28,871 [13 ] Mvc.ExceptionHandling.AbpExceptionFilter - Sequence contains no elements.
System.InvalidOperationException: Sequence contains no elements.
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken)
at Access.Tms.TmsTerminalsAppService.GetTerminalParameters(GetTmsTerminalInput input) in C:\projects\TMS\tms-backend\aspnet-core\src\Access.Application\Tms\TmsTerminalsAppService.cs:line 126
at lambda_method2525(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
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)
INFO 2021-12-24 10:37:28,874 [13 ] osoft.EntityFrameworkCore.Infrastructure - Entity Framework Core 5.0.3 initialized 'AccessDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
INFO 2021-12-24 10:37:28,878 [13 ] oft.EntityFrameworkCore.Database.Command - Executed DbCommand (3ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean)], CommandType='Text', CommandTimeout='30']
SELECT [a].[Id], [a].[CreationTime], [a].[CreatorUserId], [a].[DeleterUserId], [a].[DeletionTime], [a].[DisplayName], [a].[Icon], [a].[IsDeleted], [a].[IsDisabled], [a].[LastModificationTime], [a].[LastModifierUserId], [a].[Name], [a].[TenantId]
FROM [AbpLanguages] AS [a]
WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([a].[IsDeleted] <> CAST(1 AS bit))) AND ((@__ef_filter__p_1 = CAST(1 AS bit)) OR [a].[TenantId] IS NULL)
INFO 2021-12-24 10:37:28,884 [13 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO 2021-12-24 10:37:28,885 [13 ] c.Infrastructure.ControllerActionInvoker - Executed action Access.Tms.TmsTerminalsAppService.GetTerminalParameters (Access.Application) in 98.46ms
INFO 2021-12-24 10:37:28,885 [13 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'Access.Tms.TmsTerminalsAppService.GetTerminalParameters (Access.Application)'
INFO 2021-12-24 10:37:28,886 [69 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/2 GET https://localhost:44301/api/services/app/TmsTerminals/GetTerminalParameters?TerminalCode=TRM00001 - - - 500 207 application/json;+charset=utf-8 104.3203ms
INFO 2021-12-24 10:37:33,123 [71 ] osoft.EntityFrameworkCore.Infrastructure - Entity Framework Core 5.0.3 initialized 'AccessDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
INFO 2021-12-24 10:37:33,126 [71 ] oft.EntityFrameworkCore.Database.Command - Executed DbCommand (2ms) [Parameters=[@__p_1='?' (DbType = Int32), @__Now_0='?' (DbType = DateTime2)], CommandType='Text', CommandTimeout='30']
1 Answer(s)
-
0
Hi @fatih.ozturk Sorry for late response. I could not reproduce it. Can you please share a clean project that contains that issue?