question

SamsonZeng-1320 avatar image
0 Votes"
SamsonZeng-1320 asked ZengShengTBS-0219 commented

Some Entity Framework 5 query not working after migrating solution from VS 2012 to VS 2019

We use EF5 in our project. The same code was working in VS 2012. After migrated solution from VS 2012 to VS 2019, some EF query got the following exception:
"System.NotSupportedException: Unable to create a constant value of type ''. Only primitive types or enumeration types are supported in this context." Does anyone have the similar experience?

dotnet-entity-framework
· 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.

Hi @SamsonZeng-1320,
In order to find the cause of the problem more accurately and quickly, please provide some relevant codes to reproduce the problem and point out the specific code that caused the error.
Best Regards,
Daniel Zhang

0 Votes 0 ·

If I put the same code in a newly created VS2019 project, then there’s no such issue. It’s very weird. What factors might affect the build result?

0 Votes 0 ·

Hi @SamsonZeng-1320,
As document said, support for some project types changes over time. A newer version of Visual Studio might not support certain projects at all, or it might require that you update a project so that it's no longer backwards-compatible.
The newly created project is new and contains all the necessary things. The old project may have some things that the new version needs but does not have.
Best Regards,
Daniel Zhang


0 Votes 0 ·
Show more comments

0 Answers