Noriega
Exception about disposing DbContext
This exception I've been getting is so confusing since every other source I tried looking up for solutions doesn't exactly apply to my code. So, the exception I'm getting is that my db context gets disposed before I can use another operation on the db. Everywhere Ive checked for help had people screwing up asynchronous operations, which isnt the case for me. Here is my file for reference
Am using pooled db context btw
10 replies
Exception when attempting to use keyed dependencies
I tried making use of the new keyed DI feature that comes with net 8, but when I try injecting 2 dependencies with
IServiceCollection.AddKeyedSingleton<T1, T2>("")
, Im receiving an exception that I havent found any fix for. this kind of setup for dependencies doesn't seem to require any special setup according to the example on the microsoft page, so im confused
Code:
Exception:
15 replies
✅ Newtonsoft serializing returns nothing with custom converter
So I have a custom
JsonConverter
from newtonsoft that is supposed to replace object properties that are a specific type. For context, I'm looking for a type called IOptional
that has properties HasValue
and Value
only if HasValue is true. If HasValue is true, the converter is supposed to replace the json property with Value
. Otherwise, it replaces to null.
I have this
So just to be clear, any other token types works fine along with any objects that don't have IOptional
properties. But when I try this with types that do, serialization returns nothing. Not sure if im incorrectly writing to the jsonwriter, but its been annoying for a few days8 replies