question

Shashi-3441 avatar image
1 Vote"
Shashi-3441 asked LavanyaNooka-8766 published

.Net 6 Upgrade

Hi Team,

We are updating the .Net Core 3.1 framework to .Net 6 then we are getting this error.

System.TypeInitializationException: 'The type initializer for 'Microsoft.EntityFrameworkCore.EnumerableMethods' threw an exception.'

InvalidOperationException: Sequence contains more than one matching element



We have used a few libraries projects and its created with .Net Standard library 2.0

dotnet-runtime
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Shashi-3441 ,
Does your program run successfully in .Net Core3.1?
And have you tried running your program on .Net 5?
Waiting for your update.

0 Votes 0 ·

Does your program run successfully in .Net Core3.1? Yes, its works properly.

And have you tried running your program on .Net 5? -- No, I am upgrading from .Net Core 3.1 to .Net 6.

0 Votes 0 ·

Hi @Shashi-3441 ,
What's your Visual Studio version? .Net 6 is recommended to be used on Visual Studio 2022.
Since .Net 6 and Visual Studio 2022 are all newly released, you can consider testing it on .Net5 which is a more stable version.
Besides, if your project works well on .net5, you can post your question on GitHub issue tracker for more help about .NET6.


0 Votes 0 ·

1 Answer

maxcalvin avatar image
3 Votes"
maxcalvin answered LavanyaNooka-8766 published

Hi @Shashi-3441 - I've had this issue when I tried to move to .net 6, turns out it just needed the EF nuget package updated to the latest version. Something about .net 6 and the older EF versions wasn't playing nicely.

Not sure if you have the same problem but it's worth a try if you haven't upgraded it yet.

Good luck!
Max

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey @maxcalvin Thanks mate, it worked for me.

1 Vote 1 ·

Hi @Shashi-3441 ,
I am glad to see that your problem has been solved.
If this answer is helpful, please click "Accept Answer" so that others can quickly locate the problem and find a solution.

1 Vote 1 ·

Hi, @maxcalvin , your answer solved my problem, Thanks.

0 Votes 0 ·

Hi @maxcalvin which version of EF core did you upgrade the .net 6 code to. I am having the same issue.
Thank you

0 Votes 0 ·