Jimmacle
Jimmacle
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
it says the NRE is being thrown at C:\@PROGRAMACION\@DOTNET\Budget Management\Views\Account\Index.cshtml:line 60
20 replies
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
that doesn't mention the code you screenshotted at all
20 replies
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
a stack trace looks like this
ConsoleApplication1.MyCustomException: some message .... ---> System.Exception: Oh noes!
at ConsoleApplication1.SomeObject.OtherMethod() in C:\ConsoleApplication1\SomeObject.cs:line 24
at ConsoleApplication1.SomeObject..ctor() in C:\ConsoleApplication1\SomeObject.cs:line 14
--- End of inner exception stack trace ---
at ConsoleApplication1.SomeObject..ctor() in C:\ConsoleApplication1\SomeObject.cs:line 18
at ConsoleApplication1.Program.DoSomething() in C:\ConsoleApplication1\Program.cs:line 23
at ConsoleApplication1.Program.Main(String[] args) in C:\ConsoleApplication1\Program.cs:line 13
ConsoleApplication1.MyCustomException: some message .... ---> System.Exception: Oh noes!
at ConsoleApplication1.SomeObject.OtherMethod() in C:\ConsoleApplication1\SomeObject.cs:line 24
at ConsoleApplication1.SomeObject..ctor() in C:\ConsoleApplication1\SomeObject.cs:line 14
--- End of inner exception stack trace ---
at ConsoleApplication1.SomeObject..ctor() in C:\ConsoleApplication1\SomeObject.cs:line 18
at ConsoleApplication1.Program.DoSomething() in C:\ConsoleApplication1\Program.cs:line 23
at ConsoleApplication1.Program.Main(String[] args) in C:\ConsoleApplication1\Program.cs:line 13
20 replies
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
unless you're catching it and throwing data away before you display it somewhere
20 replies
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
you should be able to see the stack trace in the debugger when you get the exception
20 replies
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
also fwiw, a NRE has nothing to do with the actual SQL query, that's purely related to your C# code
20 replies
CC#
Created by santiw01 on 4/29/2025 in #help
✅ Object reference not set to an instance of an object.
also share the stack trace so we know if the exception is actually thrown by this method or if it's elsewhere in the call stack
20 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
the change tracker will figure that out if it sees a new item in the user's variables collection
62 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
then all you should have to do is add to the user's variables collection and call savechanges, you don't even need to explicitly set the reference to the user
62 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
if you got the object from a query on the same dbcontext (that didn't use AsNoTracking), explicitly added it with Add, or is a member of an object that meets those conditions, it's handled by the change tracker
62 replies
CC#
Created by SquidGuy on 4/24/2025 in #help
Paste Help
later
29 replies
CC#
Created by SquidGuy on 4/24/2025 in #help
Paste Help
take up with the mods, i'm not arguing this
29 replies
CC#
Created by SquidGuy on 4/24/2025 in #help
Paste Help
¯\_(ツ)_/¯
29 replies
CC#
Created by SquidGuy on 4/24/2025 in #help
Paste Help
okay, then go about your business and if you get in trouble here then you can't say i didn't warn you
29 replies
CC#
Created by SquidGuy on 4/24/2025 in #help
Paste Help
i'm not going to waste time answering that, you get the point
29 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
no, it basically means you're doing something in your EF model that is leading it to generate the wrong SQL for what actually needs to happen
62 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
if you change the ID then WHERE [Id] = @p3; is never going to find the old one
62 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
so you need to insert, not update
62 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
are you somehow changing the ID of the user (or variable) either in the entity or in the db in the middle of this happening?
62 replies
CC#
Created by Juicy on 4/26/2025 in #help
DbConcurrencyException, what am I missing?
that's fine, the change tracker can deal with that
62 replies