-
-
Notifications
You must be signed in to change notification settings - Fork 603
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
SetOutputIdentity: true
broken since update to .Net 9.0
#1646
Comments
The issue was introduced with |
Is this on SqlServer and are you using just BulkInsert or BulkInsertOrUpdate, or combining it also with IncludeGraph? |
Yes similar ! Using sqlserver, bulkinsertOrUpdate with setOutputId true and preserveOrder true. I'm also preloading new entites with id from -count to -1 (instead 0) |
Maybe I find some time for a repro in the first days of January. But yeah, guess could be related to this commit, checked the history myself and thought, that it actually could only be this one. |
I can confirm I am seeing the same thing. Not sure if it's broken on everything or not, it seems like sometimes it's working and sometimes it is not for me. I went from 3.1.1 to 3.1.2 and then I experienced the issue. I am replicating in MSSQL EXPRESS. I am NOT using .NET 9, still on .NET 8 My implementation is this: // After this write, I check database and Ids SQL database assigned are not set back properly
await _context.BulkInsertAsync(SampleRecords, new BulkConfig { SetOutputIdentity = true }); No includes or graphs and this fails. I noticed that in 3.1.1, the Ids database assigns are in order of the List I am providing to BulkInsertAsync. The table in question does have navigations to other tables - but I also see it working correctly in navigations with other tables. I cannot see any logical pattern that causes one insert set to work Vs. others. In this app, I am doing multiple different BulkInserts of different types and some of them the Ids are assigned right and some are not. |
We also noticed this "sometimes the order is random" in one of our projects. Unfortunately, some of our production data was compromised and customer data got mixed :-( |
How did you solve it? By downgrading to version |
Argh! Felt again for this version |
New version with latest source are published v 8.1.3 for EF8 and v 9.0.1 for EF9. |
Yep, works for me 👌. @Liebeck can you maybe confirm? @borisdj have you found an actual reason for this misbehavior? Want to get sure before switching to the latest version agains. Sorry but a bit afraid, that data-mess almost killed me. All appointments in my app got matched to different clients etc.. Wasn't that funny 😉 But never the less: thank you so much for your effort and this great library!! |
@angelaki sorry for the trouble. |
Ok. So I'd still check if I can build a repro so you can maybe find the issue origin and maybe add a test for it? No need to be sorry! Great work you're doing here, I'm totally fine! Mistakes happen :) |
Sure, will add a test it if you manage to make it reproducible. |
Oh wow ... it took me pretty much effort to build the repro ... but I finally did it ... Here we go:
Executing this with 8.1.2 vs. 8.1.3 results in different data! Problem is, that the @borisdj are you interessted in figuring out whats wrong here? I could send you the file via mail. |
You can send it to mail. |
@borisdj just sent you the file. I'm super excited if you can find the reason for this issue! |
@angelaki I did some more investigation but still no luck. If you find 2 sources (prior and after) that works correctly and incorrectly than by using Bisection method could with few hops isolate the one where the issue started, then we could inspect the changes in that commit or debug it. |
@borisdj but have you at least been able to reproduce the issue? Just to make sure. So it's just checking commit for commit for finding the first one having this issue, right? |
Not sure, I have downloaded this version, copied files from v8 folder to overwrite csproj(s). Change a test to make it check for expected order and to fail if not valid. |
Ok, fair - this isn't a real test, yet 😉. But I hoped it might be enough for you to find the issue. If you run it twice with different versions and compare the created databases, you'll see they differ. Since the data provided shouldn't be used in a public test atm I thought it might be enough for you to find the issue and define a test actually hitting the problem's source. And sure, not gonna check them one by one - but thanks for the hint! |
@borisdj Ok, here we got! Commit Could you be so kind and take this final step to find the issue? Seams so weird to me ... |
The second change in this commit looks suspicious, comparing two values by checking the results of toString call is not a good way to do that. |
Seems that this line was the cause: It is in a method @Zinoberous maybe you have some ideas as you have made the PR: |
@borisdj yeah, actually still broken. So weired ... But guess you haven't checked any deep what is actually causing this issue? Lucky me hasn't relied on the latest version eventhough at the time testing the data constellation was working! |
Any news on this? It took me so much effort to reproduce this issue it will break my heart if it won't get fixed ;) @borisdj have you found the reason for it? Must be super weird since even changing the values of my dataset changes the result. |
@kvpt didn't catch the time to dig more into this. |
I'm not quite sure (yet) if this issue was caused by an update of this lib or .Net 9.0 but right now the returned Ids are totally wrong! They weren't before my update. Is anyone already aware of this? Meanwhile I'm checking if the issue is caused by .Net 9.0 or this lib.
The text was updated successfully, but these errors were encountered: