-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add-Migration failing with new Microsoft.CodeAnalysis.Workspaces v4.10.0 #33970
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
Comments
Have a similar issue. Going back to "4.9.2" fixed it for now. |
Duplicate of #32926 |
Its not a duplicate, as it is a current problem and not in next major release in half a year |
@Roj At the mentioned PR there is only an update to v4.8 - this is still not the latest version. And there are breaking changes from 4.9.2 to 4.10 |
@roji Could you please consider the comment from @pocki . It seems that he mentioned a wrong person in his comment. Right now we cannot add any new EF Core migrations with Microsoft.CodeAnalysis.* packages version 4.10.0 because of this issue. |
Ropening to make sure we do the right thing for 9.0 here. |
back to previous version solved the problem on my project |
@roji To update. |
I've consulted about this internally, and we're not going to be changing the Microsoft.CodeAnalysis version in EF 9.0. IIUC upgrading to 4.10.0 would preclude usage of VS 17.8 and 17.9 for no good reason, and the recommendation in general is to not just upgrade unless our analyzers/source generators actually need a feature from the newer versions. Note that EF 10 will very likely target the net10.0 TFM, at which point older VSs probably won't be supported anyway; there's a good chance we'll upgrade our Microsoft.CodeAnalysis as well. Until then, the workaround above of manually using 4.9.2 (or whatever works) seems very reasonable. |
@roji Thanks for the update. My case as example: I can't use .NET9 and EF Core together with Microsoft.Powershell.SDK 7.5 (Powershell 7.5 is based on .NET9) |
@pocki I understand, and it's indeed an unfortunate situation. The thing is that we're not seeing a lot of people using EF through Microsoft.Powershell.SDK, or running into other similar issues - this issue has only one vote... And upgrading to 4.10.0 brings its own problems as we've seen. The good news is at least that this problem will at some point go away on its own, and until then there seems to be a decent workaround, with the user explicitly setting the version to 4.9.2 etc. Hopefully that's good enough for the time being. |
Hm, so to answer my question here #32070 (comment), it seems it's not possible to upgrade even in .NET 9. :-| |
Same issue. Carter 9.0 requires 4.11, so I ran into this as well. Had to downgrade carter to 8.21 to get EF migrations created. |
Another vote here - I'm also using Carter this dependency issue is causing me to not be able to use EF Core in my projects. I must say, I don't expect this sort of dependency issue to be present in .NET. It's starting to feel like JavaScript/Node. |
Everyone, it's indeed unfortunate that this issue exists - read above for the explanation/reasons. I can say almost with certainty that we won't be patching EF 9.0 to change the version, but EF 10.0 should be fine (I've opened #35187 to make sure we do the right thing there). |
Why can't the dependency be set so that it will at least accept/work with the newer version if it's installed while retaining backwards compatibility? i.e. set the dependency to "at least 4.9.2" |
Conflict with TimeWarpState, too. Currently blocking the entire project. I can't figure out how to configure around it. Nothing works. |
Everyone, please note that as far as we know, using version 4.9.2 works around the problem - please read the issue from the beginning. Although the situation isn't great, we're not currently aware of a case that cannot be worked around with EF 9 - if there is one, we need to see a minimal repro. |
TimeWarpState currently requires 4.11.0. TWS is used in a library that is nested deep in the project hierarchy. The package author is reviewing a workaround on his end. In the meantime, I created an API project with no endpoints that references all the schemas in all the modules. It does not reference TWS because it doesn't need all the nested projects to do zero work. I just now finished migrating all my databases, etc. using this new project. This workaround will be fine for me until EF 10. Thanks for responding - huge fan of EF Core. |
Good to hear that you've found a workaround. Everything should be fine for EF 10 in any case. |
After upgrading from .net6 to .net 9 I had to use 4.9.2 no less no more, when doing dotnet-ef migrations add ... |
Version 4.12.0 and the problem still persists, forcing us to revert to 4.9.2 for 'dotnet ef migrations'. Any expectations for a fix? |
@rogmauri please read all of the above. |
Looks like #35187 has been closed as well with yet another issue opened at #34637 to supposedly address it in 10.0.0 |
This issue has constituted a major time-sink for me today. I cannot readily downgrade the CodeAnalysis package because another in the same project relies on 4.10.0. Separating the context into a separate project with its own set of dependencies may technically be a "workaround", but it's not a very expedient one that presents its own problems. |
Everyone, #35753 has just been merged, bumping Microsoft.CodeAnalysis.Workspaces to the recently released 4.13.0 for EF 10. Going forward, we have also decided to always targeted the latest .NET TFM (so EF 10 will target net10.0, EF 11 will target net11.0), allowing us to also keep the Microsoft.CodeAnalysis up to date and on the latest version (latest compiler/VS would be required in any case). Re the current situation in 9.0, I don't have much to add beyond what's already written above. Changing the required Microsoft.CodeAnalysis version would break a lot of people. |
The status quo also breaks a lot of people, such as myself and previous commenters. Umbraco, a popular CMS package, has a dependency on v4.10.0 of CodeAnalysis specifically - this appears to present a situation where any Umbraco solution which also makes use of this version of EF Core cannot add any migrations. I'm sure there'll be other packages out there which are also dependent on this version. |
It's very different to say that there's an incompatibility using EF with some other, unrelated package (Umbraco), and asking for a breaking change to be done in an EF 9.0; the latter would cause EF users upgrading to a new patch version (regardless of any other packages). There is an extremely high bar for us for introducing a breaking change in a patch version, and this doesn't seem anywhere close to it. If you prefer, you can stay with EF 8.0 for now, until 10 is released in a few months. Otherwise, you can also file a request with Umbraco to support earlier versions of Microsoft.CodeAnalysis. |
EF8 is the version I am using, and the version both myself and OP encountered this issue in. I am not asking for any changes to be made to 9, 8 is the version exhibiting this issue. Can I assume your answer is the same in this circumstance, and this issue will not be resolved for this version either? |
@eqtr-ab yes, that same logic holds - even more so - for EF 8.0, which is a long-term release. We'd be breaking existing EF 8.0 users by releasing an 8.0 patch version that changes the Microsoft.CodeAnalysis version. |
If it's worth anything to anyone, I fixed my .NET 8 projects with the following:
Specifically, adding the first two packages was key - in my case, transitive dependencies were mixing 4.5.0 and 4.10.0, which caused the |
Just upgraded to No more migration building issues. |
Bug Microsoft.CodeAnalysis.* version dependencies
ASP.NET Core Web API with EF Core 8.0
I need to reference Microsoft.CodeAnalysis.* directly with a newer version (instead of v4.5.0) because of other dependencies like Powershell.SDK - see #32070
This was working fine until v4.9.2 of Microsoft.CodeAnalysis.* packages. Except the warning about version mismatch.
After update to v4.10.0 the Add-Migration crashes.
Please make it working also with newer versions of Microsoft.CodeAnalysis. and don't stick to an (very) old version.
Directory.Packages.props:
Stack traces
Provider and version information
EF Core version: 8.0.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: Windows 11 23H2 (Build 22631.3737)
IDE: Visual Studio 2022 17.10 and Visual Studio 2022 17.11 Preview 2.0
The text was updated successfully, but these errors were encountered: