HangfireIO / HangfireIO/Hangfire

SqlException (0x80131904): Error converting data type nvarchar to bigint.

Open
#1,880 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

hangfire version:1.7.23

````
Content root path: E:\vsproject\net5\WebApplication1
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HM9FPPD1S4MM", Request id "0HM9FPPD1S4MM:0000000D": An unhandled exception was thrown by the application.
System.Data.SqlClient.SqlException (0x80131904): Error converting data type nvarchar to bigint.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at System.Data.SqlClient.SqlDataReader.Read()
at Dapper.SqlMapper.GridReader.ReadDeferred[T](Int32 index, Func`2 deserializer, Type effectiveType)+MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Dapper.SqlMapper.GridReader.ReadImpl[T](Type type, Boolean buffered)
at Dapper.SqlMapper.GridReader.Read[T](Boolean buffered)
at Hangfire.SqlServer.SqlServerMonitoringApi.<>c__DisplayClass21_0.b__0(DbConnection connection)
at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func`2 func)
at Hangfire.SqlServer.SqlServerMonitoringApi.UseConnection[T](Func`2 action)
at Hangfire.SqlServer.SqlServerMonitoringApi.JobDetails(String jobId)
at Hangfire.Dashboard.Pages.JobDetailsPage.Execute()
at Hangfire.Dashboard.RazorPage.TransformText(String body)
at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context)
at Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
````
` BackgroundJob.Enqueue(() => Console.WriteLine("Hello world from Hangfire!"));`
simple demo . when open `http://localhost:5000/hangfire/jobs/details/1` where see this error and click retry will get this error also

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by opening the Hangfire dashboard job details URL and selecting Retry. Start at Hangfire.SqlServer.SqlServerMonitoringApi.JobDetails in the stack trace, then trace the dashboard's database read and Dapper result mapping. Done means the job details and retry actions no longer fail with the nvarchar-to-bigint conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.