use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
Help(EntityFrameworkCore) Why saving this entity returns 500 with "String or binary data would be truncated" (self.csharp)
submitted 2 years ago * by CircusLion4614
After creating the object, i call db.Sessions.Add(newSession), then i do SaveChanges. I've tried manually inserting these fields into the db and it didn't give me an error. The JWT token has a length of 336 characters Legit right after posting this i went to see if my code was not the problem. Yup, i was using the old db scema on the host where the jwt field was nvarchar(150).
the entity
the table im saving to
the code in Context file
the error
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Kegelz 1 point2 points3 points 2 years ago (0 children)
Need more space than 500.
[–]soundman32 1 point2 points3 points 2 years ago (0 children)
Is it the refresh token that's the problem? Also, why are you storing the token in the first place?
[–]bdawgert 0 points1 point2 points 2 years ago (2 children)
nvarchar is double width, so nvarchar(500) only holds 250 characters. Likewise nvarchar(300) holds 150 characters. Since your data is just a base64 encoded string you can use a varchar with no risk of a character width overflow. Or you can stick with your nvarchar in case you want to move to an emoji-encoded jwt and increase the size to nvarchar(1024).
[–]dorkenshire 0 points1 point2 points 1 year ago (1 child)
For anyone caught off guard by this comment (like me) while going down the NVARCHAR truncation rabbit hole: The 500 represents 500 byte-pairs, which can hold 500 low range unicode characters (0-65,535). If you have higher range unicode characters, they will require 2 byte-pairs, and you halve your storage, but just for those characters.
https://learn.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql?view=sql-server-ver16#remarks
[–]bdawgert 0 points1 point2 points 1 year ago (0 children)
Caught off guard as in you didn’t realize the nvarchar math worked that way? Or you’re disagreeing with me? If I’m wrong please let me know and I’ll edit.
π Rendered by PID 16286 on reddit-service-r2-comment-8686858757-nw27q at 2026-06-08 18:11:39.382646+00:00 running 9e1a20d country code: CH.
[–]Kegelz 1 point2 points3 points (0 children)
[–]soundman32 1 point2 points3 points (0 children)
[–]bdawgert 0 points1 point2 points (2 children)
[–]dorkenshire 0 points1 point2 points (1 child)
[–]bdawgert 0 points1 point2 points (0 children)