Skip to content
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

Test MDS edmx with VS 17.5 #118

Closed
ErikEJ opened this issue Feb 23, 2023 · 43 comments
Closed

Test MDS edmx with VS 17.5 #118

ErikEJ opened this issue Feb 23, 2023 · 43 comments

Comments

@ErikEJ
Copy link
Owner

ErikEJ commented Feb 23, 2023

See #119

See dotnet/ef6tools#41 for a fix in progress

@ajcvickers FYI

@robertmclaws
Copy link

So, I've pulled down this project and tried opening the Model1.edms file in SmokeTestNetFx on both my main system, and TWO separate clean systems I spun up on Windows 11.

On all 3 systems, when I change SmokeTestNetCore to the following, I get a NullReferenceException when trying to open the designer.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net48;net6.0</TargetFrameworks>
    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="..\SqlProviderSmokeTextNetCore\Test1.cs" Link="Test1.cs" />
  </ItemGroup>

  <ItemGroup>
    <None Include="..\SmokeTestNetFx\Model1.edmx" Link="Model1.edmx" />
    <None Include="..\SmokeTestNetFx\Model1.edmx.diagram" Link="Model1.edmx.diagram" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="ErikEJ.EntityFramework.SqlServer" Version="6.6.3" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
    <PackageReference Include="xunit" Version="2.4.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
    <PackageReference Include="coverlet.collector" Version="1.2.0" />
  </ItemGroup>

</Project>

I'm using the same project configuration in my own app, with the same result.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 9, 2023

@robertmclaws The designer only works on pure .NET Framework projects. Are you not able to open The designer in the unmodified NetFX smoke test project?

@robertmclaws
Copy link

robertmclaws commented Mar 9, 2023

So, EF6 works under both .NET Framework and .NET Core. The designer used to work just fine in this configuration under VS2022 when the provider was System.Data.SqlClient.

NOW it doesn't even work in that situation, and model updates are totally broken.

The designer needs to work on any platform that EF6 works on.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 9, 2023

 Are you not able to open The designer in the unmodified NetFX smoke test project?

Please reply. As far as I know the designer never worked with s ting else than classic .NET Framework projects

@robertmclaws
Copy link

robertmclaws commented Mar 9, 2023

No. It is still giving a Null Reference Exception on all 3 systems.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 9, 2023

On another PC also? Which VS version?

Share you 64 bit machine.config system.data section.

@robertmclaws
Copy link

robertmclaws commented Mar 9, 2023

Windows 11 x64, VS2022 17.5.1 x64.
This is all that's in there, on all 3 machines:

    <system.data>
        <DbProviderFactories />
    </system.data>

Not sure if it is supposed to be different, or of Windows Update is overwriting it, or what.

@robertmclaws
Copy link

Are you not able to open The designer in the unmodified NetFX smoke test project?

Please reply. As far as I know the designer never worked with s ting else than classic .NET Framework projects

Also, if you look at the project file I posted, it used to work if you listed .NET 4.8 FIRST in the list of projects to compile. I've been using it that way for the last 3+ years.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 18, 2023

@robertmclaws can you share a repro project, I am confused with talk about new project types and multiple target frameworks.

The designer only works with classic. Net framework projects.

@robertmclaws
Copy link

robertmclaws commented Mar 20, 2023

You've said a couple times now "the designer only works with classic .NET Framework projects." As I have mentioned a few times now, that statement is not accurate. The designer works in SDK-style projects as well, but the .NET Framework (net462, net47, net471, net472, or net48) HAS to be specified as the first entry in <TargetFrameworks />

I know this because I've been using it this way for 3 years now.

Here's your test project modified with changes that will let the EDMX Designer be opened in "SmokeTestNetCore". (Note the project open in the tab well)

image

If you change the EDMX file back to Microsoft.Data.SqlClient and then try to open it in the designer, you you will get a NullReferenceException.

image

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

Ok, I will have a look at this advanced scenario but still you never replied to my question:

Are you able to open the designer in the unmodified NetFX smoke test project?

@robertmclaws
Copy link

robertmclaws commented Mar 20, 2023

Not with Microsoft.Data.SqlClient as the provider in the EDMX file. When I change it back to System.Data.SqlClient, it opens fine.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

I can open it just fine, so something is different on your machine(s).

And finding out what that could be seems more important to me before we move to Advanced, unsupported Configurations;

https://learn.microsoft.com/en-gb/ef/ef6/what-is-new/#ef-designer-support

What error do you get when you try to open the designer in the unmodified NetFX project?

Have you looked in the AciivityLog.xml file?

@robertmclaws
Copy link

robertmclaws commented Mar 20, 2023

It does not work on a clean Windows 11 system, version 25309.1000, with a clean Visual Studio 17.5.1 installed. The error message it presents is the same as my screenshot above.

This seems relevant from the ActivityLog.xml:
image

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

Thanks.

I am running Windows 10 with VS 17.5.1. Do you have a Windows 10 test machine/VM available?

@robertmclaws
Copy link

No, I do not. Maybe it's a good opportunity for you to spin up a Windows 11 VM? I know that Hyper-V Quick Create has a Windows 11 Dev VM on there that might be good.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

The designer opens fine for me on a clean, new VS image from Azure with Windows 11.

@robertmclaws
Copy link

All it gives me is the message in the 2nd screenshot. I don't have a stack trace. Debugging a VS instance with another VS instance does not produce a stack trace.

What .NET Frameworks are installed on that instance?

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

What .NET Frameworks are installed on that instance?

Is there not only one?

Maybe you can share your machine.config file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config (privately if you prefer) and I can do a compare

@robertmclaws
Copy link

There are definitely more than one.
image

My machine.config in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config is identical to machine.config.default.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

Ah, you mean targeting packs for Visual Studio. Let me check

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

@robertmclaws I have these:

image

@robertmclaws
Copy link

I did a full VS repair, and on that Windows 11 with VS 2022 Professional 17.5.1, it will not open the model with Microsoft.Data.SqlClient.

I also downloaded the Windows 11 dev image from Hyper-V, updated it with the EF6 tools, and opened my fork of the project and got a NullReferenceException in the SmokeTestNetFx project.

That's 4 different machines on my end, all with the same result. Not a coincidence.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 20, 2023

@robertmclaws I really appreciate all your effort, but sadly I have now tried on two machines and am unable to repro. Really annoying.

A Teams meeting perhaps, if you are interested in taking this further?

@robertmclaws
Copy link

Sure! Want to DM me on Twitter and we'll set it up?

@robertmclaws
Copy link

Question, are you opening from my repo or yours?

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 21, 2023

I am always opening from my unmodified repo

@robertmclaws
Copy link

We'll go over it on a call, but I spent like 2 hours putting together a consistent reproduction of the issue for you in a forked repo. I linked to it a while back, but here it is again: CloudNimble@07230f3

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 21, 2023

Yes, I saw that - but it just adds more complexity to the issue and is not a supported configuration.

@robertmclaws
Copy link

It still reproduces the issue in supported configurations.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 22, 2023

@robertmclaws Yes, for you, I know, so let us focus on that.

@ryanbrandenburg @CZEMacLeod @jasonmalinowski @ajcvickers @bricelam

@ajcvickers
Copy link

@ErikEJ I get a null ref exception with VS Community 17.5.3 and VS Enterprise 17.6.0 Preview 2:

image

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 23, 2023

@ajcvickers Thanks for confirming.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 23, 2023

@ajcvickers Really odd that it works for me on two machines. I will try a third

@CZEMacLeod
Copy link

@ErikEJ Just checked with VS Pro 17.5.2 then 17.5.3 after updating
Same thing on 17.5.2 but it worked on 17.5.3!
image
image

Literally did nothing different. Hit the update on close notification. Closed VS. Updated. Reopened VS and the solution as before, then just double clicked the Model1.edmx (as before).
Was expecting the same result but no. Sorry to muddy the waters here!
Only thing I can think of is if I tried to open it too 'early' (before package restore completed maybe?) the first time, and the second time it had had time to complete the loading and restore.

@CZEMacLeod
Copy link

@robertmclaws @ErikEJ For reference, I also have many projects that are SDK style containing edmx files (I extract them from the migration resx file so I can view the model as a reference if I need to - they have Build Action = None).
As long as I single target Net framework or multitarget with framework first they seem to open just fine.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net47;netstandard2.1</TargetFrameworks>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>

These are using the System.Data.SqlClient provider just now, but I am looking to change that in the future, once this package is fully released and I have some time to ensure I can make the switch without breaking any of my other code.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 23, 2023

@CZEMacLeod I would imagine a package restore and background build would be needed, as the provider is enabled via app config in the test app itself. Much appreciate your time!

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 23, 2023

@ajcvickers @robertmclaws Are you able to get the latest community branch commits and give it another try, I just made some small adjustments.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 23, 2023

@CZEMacLeod Genius! I was finally able to repro by nuking the packages folder!
Unloading/reloading the solution or project removed yellow warning signs from the references node, and then I was able to open the designer. Patience, my dear 😄

@robertmclaws
Copy link

I'm glad we're starting to make progress, and that more than 1 person has validated a) my issue, and b) my use case.

I just want to point out that you would have found this problem sooner if you had pulled down my branch, which would not have had compiled binaries in the bin folder, and then tried opening the model before compiling.

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 23, 2023

@robertmclaws So are you able to open The designer now??

@ErikEJ ErikEJ closed this as completed in 5feacbe Mar 24, 2023
@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 24, 2023

@ryanbrandenburg Maybe the error message could be improved here?

@ErikEJ
Copy link
Owner Author

ErikEJ commented Mar 26, 2023

@robertmclaws Assume you got the 4th machine running then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants