Skip to content

Update to .Net6 #131

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

Merged
merged 39 commits into from
Dec 8, 2022
Merged

Update to .Net6 #131

merged 39 commits into from
Dec 8, 2022

Conversation

ChrisJollyAU
Copy link
Member

@ChrisJollyAU ChrisJollyAU commented Oct 23, 2022

After a lot of work recently, this seems to be stable enough to merge to the main branch

It has been updated to .Net/EF Core 6 with all the latest dependencies. Most standard things are working with the exception of the normal Jet limitations (Schemas, computed columns, sequences, no skip...take and some basic types that have no equivalent in Jet e.g. DateTimeOffset, TimeSpan, DateOnly, TimeOnly)

Tests: A large number of tests have been updated to make sure they compile and work.
Most tests now that do fail in general fall in one of 2 categories

  1. Tests that test or include an unsupported feature. Will probably never work
  2. Tests that generate a different SQL than what is expected.
    2.1. Some of these are because EF Core itself has changed since the test was last looked at and the SQL is by default different
    2.2. Others are because of certain functions have to be rewritten for Jet. Most common are the CASE...WHEN, CAST, COALESCE statements which have been rewritten using IIF statements

Will be continuing work on getting more tests working

@lauxjpn or @bubibubi Can we look at getting this merged

…s compaitiblity so that code written for multiple databases doesn't error. For Jet, the function won't do anything
…expressions manually. Fixes queries with conversions
… an integer, make it the identity column. This wasn't being set by default
… named for the test - gives each test a unique name so doesnt interfere with others at the same time. The rest of the tests already use it, these couple were just missed
… (bool, int,double,datetime,byte,decimal,single)
…terceptor, it has already gotten the original commandText. Any comparisons between the actual result and the interceptor would fail
…will always return as a default 0 (a non null value), if TryGetDefaultValue fails. Thus the wrong ValueGenerationStrategy is returned
… regex depends on using this format to pick the filename from the connection string
@j-fdion
Copy link

j-fdion commented Nov 8, 2022

Any on update on this? Thank you!

@nicovil
Copy link

nicovil commented Nov 9, 2022

.net 7 is out! It's a good moment to do this merge now and maybe start with changes for .net 7. Things are moving fast!

@ChrisJollyAU
Copy link
Member Author

Haven't heard anything from @bubibubi or @lauxjpn so not sure. Still going through each test to see if I can make it pass

@nicovil Already have a ef core 7 build set up. Busy going through the tests to see if there are any major differences in what is passing or failing

@nicovil
Copy link

nicovil commented Nov 9, 2022

Haven't heard anything from @bubibubi or @lauxjpn so not sure. Still going through each test to see if I can make it pass

@nicovil Already have a ef core 7 build set up. Busy going through the tests to see if there are any major differences in what is passing or failing

Hi @ChrisJollyAU . I cloned a fresh copy of your net6 repo and migrated stuff to .net 7, there are some changes in some visitors that makes the existing code not to compile, however they're 4 or 5 source code files only that needs to be fixed. There are some deprecated methods issues too.

@ChrisJollyAU
Copy link
Member Author

@nicovil try the ef7 branch then

@ShamilS
Copy link

ShamilS commented Nov 9, 2022

Haven't heard anything from @bubibubi or @lauxjpn so not sure. Still going through each test to see if I can make it pass

@nicovil Already have a ef core 7 build set up. Busy going through the tests to see if there are any major differences in what is passing or failing

@ChrisJollyAU Oh :) I have also made a test .net 7 build of the subject codebase and I have run the tests:

EFCore.Jet.IntegrationTests:  
     77 passed, 29 failed (106 - total)

EFCore.Jet.Tests:                      
      15 passed, None failed    (15 - total)

EFCore.Jet.Data.Tests:           
      67 passed,  14 failed   (81 - total)

EFCore.Jet.FunctionalTests: 
     4084 passed, 8296 failed, 146 skipped, 4057 not run  (16583 - total)

I missed your .Net7 branch, I will watch its progress now . In the case any help with the tests' fixes is needed I may try to contribute.

Thank you for your great work!

@ChrisJollyAU
Copy link
Member Author

Just to keep this PR dedicated to .Net 6, use #132 for anything EF 7 related

@timecreators
Copy link

@bubibubi is there a reason that this PULL-Request is ignored?

Would be really cool to officially provide the .NET 6 release!

Btw: Thanks a lot to @ChrisJollyAU

@ChrisJollyAU
Copy link
Member Author

@timecreators I'd love to merge it too. Would do it if I had the permissions. In the meantime, I'm just trying to get all the SQL for the tests up to date and outputting as expected. Then to try sort out any further errors

@bubibubi
Copy link
Member

bubibubi commented Dec 7, 2022

@bubibubi is there a reason that this PULL-Request is ignored?

Would be really cool to officially provide the .NET 6 release!

Btw: Thanks a lot to @ChrisJollyAU

So sorry about this... I'm working hard on another project so I can just follow your great work.

@bubibubi
Copy link
Member

bubibubi commented Dec 7, 2022

@timecreators I'd love to merge it too. Would do it if I had the permissions. In the meantime, I'm just trying to get all the SQL for the tests up to date and outputting as expected. Then to try sort out any further errors

@ChrisJollyAU you should be able to merge now.

@ChrisJollyAU
Copy link
Member Author

@bubibubi Thanks. Going to look into merging it in the next couple of days. Also will have a look at making a nuget release if I have the permissions

@timecreators
Copy link

@bubibubi @ChrisJollyAU A big thank you for your effort!

@ChrisJollyAU ChrisJollyAU merged commit 9573229 into CirrusRedOrg:master Dec 8, 2022
@ChrisJollyAU
Copy link
Member Author

For all those following, this has now been merged into the master branch

@ShamilS
Copy link

ShamilS commented Dec 8, 2022

For all those following, this has now been merged into the master branch

@ChrisJollyAU Great work, thank you!

I have just used the new version on my box with .NET 7 and VS 2022. I have changed global.json to:

{
  "sdk": {
    "version": "7.0.100",
    "allowPrerelease": false,
    "rollForward": "latestFeature"
  }
}

and I have run all the tests. Here are the results:

  • EFCore.Jet.Data.Tests

      Tests in group: 81
      Total Duration: 39.3 sec
       Outcomes
           81 Passed
    
  • EFCore.Jet.FunctionalTests

       Tests in group: 9522
       Total Duration: 2.5 min
       Outcomes
          7129 Not Run
          1773 Passed
          615 Failed
          5 Skipped
    
  • EFCore.Jet.IntegrationTests

      Tests in group: 106
      Total Duration: 16.5 sec
      Outcomes
          79 Passed
          27 Failed
    
  • EFCore.Jet.Tests

      Tests in group: 15
      Total Duration: 21.5 sec
      Outcomes
         15 Passed
    

@ChrisJollyAU
Copy link
Member Author

@ShamilS you would still be targeting ef core 6 not ef core 7.

Also, doesn't look like you are running most of the functionaltests. From your results most are shown as not run

@ShamilS
Copy link

ShamilS commented Dec 8, 2022

@ShamilS you would still be targeting ef core 6 not ef core 7.

@ChrisJollyAU I intentionally did so - just to see how it will work. I do not have .NET 6 at all on my main development PC now.
I have rerun EFCore.Jet.FunctionalTests. Results are:

     Tests in group: 9522
     Total Duration: 6,4 min
      Outcomes
         5067 Passed
         4270 Failed
         185 Skipped

Do these results look similar to yours?

I have then used another box with .NET 6 SDK v. 6.0.306 - the results for

  • EFCore.Jet.Data.Tests
  • EFCore.Jet.IntegrationTests
  • EFCore.Jet.Tests

are the same as for .NET7.
For the EFCore.Jet.FunctionalTests there are many tests, which do not run at all when running all the tests first time from within VS2022 Test Explorer. But when running some of the individual groups of tests of EFCore.Jet.FunctionalTests project - they run OK.

Should dotnet CLI be used to run the tests to have all of them running in proper order? (VS2022 Test Explorer Runner seems to be trying to run the tests (from different test projects) in parallel.

@ChrisJollyAU
Copy link
Member Author

@ShamilS I have the same as you, but for my FunctionalTests this is the result
EFCore.Jet.FunctionalTests
Tests in group: 9522
 Total Duration: 9.1 min

Outcomes
 5069 Passed
 4268 Failed
 185 Skipped

@ShamilS
Copy link

ShamilS commented Dec 9, 2022

@ShamilS I have the same as you, but for my FunctionalTests this is the result EFCore.Jet.FunctionalTests Tests in group: 9522  Total Duration: 9.1 min

Outcomes  5069 Passed  4268 Failed  185 Skipped

@ChrisJollyAU Great news! My I assume that your current version of the EntityFrameworkCore.Jet -> Net6 is also .NET7 ready?
According to the stats there are just two(?) tests, which worked for you and not worked for my .NET7 tests.

Now if I log the EFCore.Jet.FunctionalTests running for .NET7 in a file and you do similar logging for EFCore.Jet.FunctionalTests running for .NET6 then we can find what is the difference and you'll get an opportunity to have released both .NET6 and .NET7 versions of the EntityFrameworkCore.Jet.

I'm running the tests here using the following dotnet CLI command line:

  dotnet test {{FullPathToProjectFolder}}\EFCore.Jet.FunctionalTests.csproj  --consoleLoggerParameters:ErrorsOnly --logger:console >!EFCore.Jet.FunctionalTests.log

But when I run the functional tests by the above command line I'm getting the following total stats:

        Failed!  - Failed:   360, Passed:   815, Skipped:     1, Total:  1176, Duration: 2 m 1 s - EntityFrameworkCore.Jet.FunctionalTests.dll (net6.0)

IOW, quite a few tests do not run somehow at all. How should I change the dotnet CLI command line to have all/most of the tests running?

Is there an (easy built-in into dotnet CLI options) way to collect just the names of the failed tests' classes and methods?

AFAIS I can write a simple code to collect the failed methods' and their classes(?) by parsing log file search for the Error Message: keywords and collecting the previous and the following to these keywords log file lines:

....

  Failed Model19_1_1Run [53 ms]
    Error Message:
     Test method EntityFrameworkCore.Jet.IntegrationTests.Model19_1_1.Model19_1_1JetTest.Model19_1_1Run threw exception: 
        System.InvalidOperationException: The value of 'ClassB.Id' is unknown when attempting to save changes. This is because the property is also part of a foreign key for which the principal entity in the relationship is not known.

...

   Failed OrderBy_Skip_Count [58 ms]
   Error Message:
   Test method EntityFrameworkCore.Jet.IntegrationTests.Model_MainTests.MainJetTests.OrderBy_Skip_Count threw exception: 
        System.InvalidOperationException: Jet does not support skipping rows. Switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync() if needed.

...

Thank you.

P.S. Here is my test environment - it's a new laptop without any legacy .NET versions.

  .NET SDK:
   Version:   7.0.100
   Commit:    e12b7af219
  
  Runtime Environment:
   OS Name:     Windows
   OS Version:  10.0.22621
   OS Platform: Windows
   RID:         win10-x64
   Base Path:   C:\Program Files\dotnet\sdk\7.0.100\
  
  Host:
    Version:      7.0.0
    Architecture: x64
    Commit:       d099f075e4
  
  .NET SDKs installed:
    7.0.100 [C:\Program Files\dotnet\sdk]
  
  .NET runtimes installed:
    Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  
  Other architectures found:
    x86   [C:\Program Files (x86)\dotnet]
      registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
  
  Environment variables:
    Not set
  
  global.json file:
    Not found
  
  Learn more:
    https://aka.ms/dotnet/info
  
  Download .NET:
    https://aka.ms/dotnet/download

@ChrisJollyAU
Copy link
Member Author

@ShamilS Just changing the global.json is just changing the SDK used to compile it with. It doesn't change the target framework and any other references. In one of your results you can still see the (net6.0) at the end.

There's not really a .Net 7 specific version out that will be out. EFCore.Jet is really tied to the related version of Entity Framework Core. So far EFCore and .Net (Core) have been linked (as in the version of EF Core can only be used with the same version of .Net Core).

This has changed with EF Core 7 as instead of it being only for .Net 7, you can use it on both .Net 6 and .Net 7. That's why #132 refers to EF Core 7 rather than .Net 7

@ShamilS
Copy link

ShamilS commented Dec 9, 2022

@ShamilS Just changing the global.json is just changing the SDK used to compile it with. It doesn't change the target framework and any other references. In one of your results you can still see the (net6.0) at the end.

@ChrisJollyAU Thank you for your explanations. Still the question is why there are two more successful tests on your side when running tests from withing VS2022 and what are these failed here two tests?

What should be the dotnet CLI command line to run all the tests of the EFCore.Jet.FunctionalTests.csproj project?

If you don't have an out-of-hand answer on the latter question - just ignore both. If you do have - please post here the dotnet CLI command.

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

Successfully merging this pull request may close these issues.

6 participants