-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dapper works for a while, then can't find constructor #2142
Comments
Random question: are the columns perhaps in a different order on the two systems, using |
It's the same Docker image, running in the same K8s environment, just scaled out to 2 instances. The obfuscated query is like this. We are testing without
|
Looking at the FindConstructor method in Dapper and the error message kicked out after it returns null here it looks like there's a match of name, type, and order.
|
After changing the |
That's good guidance generally - in fact, if you install either Dapper.AOT or Dapper.Advisor, it will (if it understands your SQL variant) offer DAP219 warnings on SQL with |
It ran several days without any problems, but came back after the pods ran for 5 days. Any other hints/tips would be appreciated. |
My suggestion would be : try enabling AOT, even if just on that one path - the AOT path never has to resolve anything - the analysis happens at build time: https://aot.dapperlib.dev/gettingstarted |
We could try it, but couldn't use it in production, since doesn't that require interceptors, which is still in preview until 9.0.2xx according to https://github.com/dotnet/roslyn/blob/main/docs/features/interceptors.md Latest is 9.0.102. It's so weird that it runs for days fine then suddenly can't find the constructor. |
If your policy prohibits you from flipping that switch, then I guess we'll have to wait. I would suggest perhaps trying it locally to see if there are any hurdles, to minimise delays. I have no explanation for why it loses the constructor, but I do know that AOT doesn't ever need to go looking for it. |
Dapper 2.1.35
Dapper.Contrib 2.0.78
We have two pods running the same image in K8s that query a table and map to an object using Dapper. Both will work fine for a while, then one will start consistently getting this error. The object has the four properties show in the constructor in the error message and two properties with
[Compute]
. We are usingselect *
in the query and are going to remove that and see if that helps.We have a constructor that maps the signature. To try to fix it, we added a default constructor and now it doesn't error out, but we get back n objects with default values.
The other pod running the same image continues to work and will return n objects with values from the db. Recycling the pod fixes it -- for a while.
It's as if the generated mapping worked, then got regenerated, but fails.
To Reproduce
I wish I could tell you more. Running locally it never happens. Only in prod (of course) in AKS. Non-prod AKS doesn't seem to have the problem.
Expected and actual behavior
The mapping to the object should not throw an exception and fill out the object
Additional context
Add any other context about the problem here:
The text was updated successfully, but these errors were encountered: