Skip to content

Conversation

@xsoheilalizadeh
Copy link
Contributor

@xsoheilalizadeh xsoheilalizadeh commented Apr 4, 2023

I'm working on improving the infrastructure, meanwhile, I noticed builds are failing on .NET 7 because the operators are overrided for Guid.

The build fails with the following error:

Ambiguous invocation:    bool operator <=(object, Cassandra.Data.Linq.CqlFunction) (in class CqlFunction)    bool operator <=(System.Guid, System.Guid) (in struct Guid) match 
@xsoheilalizadeh xsoheilalizadeh marked this pull request as ready for review April 4, 2023 15:46
@joao-r-reis
Copy link
Collaborator

I noticed builds are failing on .NET 7

Building the driver or building an app with the driver installed?

@xsoheilalizadeh
Copy link
Contributor Author

Both

@joao-r-reis
Copy link
Collaborator

I'm working on improving the infrastructure

Can you clarify what you are working on? Deep changes to the driver should be discussed beforehand.

Both

I just installed .NET 7 and I can build the driver just fine, you probably need to install an earlier version of the SDK maybe? Can you tell me which sdk versions you have installed? I also created a new Console App that targets .NET 7, installed the driver and I can build this app just fine too.

@xsoheilalizadeh
Copy link
Contributor Author

xsoheilalizadeh commented Apr 5, 2023

Can you clarify what you are working on? Deep changes to the driver should be discussed beforehand.

Sure, I'm trying to drop the old .NET Core versions since they are deprecated and cleaning the csproj files.

I just installed .NET 7 and I can build the driver just fine, you probably need to install an earlier version of the SDK maybe? Can you tell me which sdk versions you have installed? I also created a new Console App that targets .NET 7, installed the driver and I can build this app just fine too.

If you set the driver to build on .NET 7 these tests would have the error that I mentioned above. Same issue when using the driver as a package and trying to use operators on MaxTimeUuid/MinTimeUuid methods
https://github.com/datastax/csharp-driver/blob/master/src/Cassandra.Tests/Mapping/Linq/LinqToCqlFunctionTests.cs#L39-L48

@joao-r-reis
Copy link
Collaborator

joao-r-reis commented Apr 5, 2023

Ok, I understand. So we are planning on doing a platform update for the C# driver (basically adding currently supported .NET versions to the test projects and dropping the EOL ones) in the near future but this requires some effort on our jenkins infra that runs these tests.

Keep in mind that we will not change the targets of the driver project itself, we will keep targeting net452;netstandard2.0 for the driver package.

Because of the backend work that this requires I think it would be best if you held off on making these changes for now.

For the issue itself I just finished testing the following:

var results = t.Select(x => x).Where(x => x.Key >= CqlFunction.MinTimeUuid(DateTimeOffset.UtcNow)).AllowFiltering().Execute().ToList(); 

This results in the issue you are seeing with .NET 7 but there's an easy work around:

var results = t.Select(x => x).Where(x => x.Key >= (Guid)CqlFunction.MinTimeUuid(DateTimeOffset.UtcNow)).AllowFiltering().Execute().ToList(); 

For now I recommend applying this work around until we are ready to deliver proper support of .NET 7. This should happen sometime in the next few months.

@joao-r-reis
Copy link
Collaborator

I will keep this PR open until we have all the test projects and infra ready to test this PR. Again, this can take a while so it's likely that this PR will stay open for a few months.

@joao-r-reis
Copy link
Collaborator

Also, please sign our CLA: https://cla.datastax.com/

@xsoheilalizadeh
Copy link
Contributor Author

Keep in mind that we will not change the targets of the driver project itself, we will keep targeting net452;netstandard2.0 for the driver package.

Yes, I'm aware of this.

Because of the backend work that this requires I think it would be best if you held off on making these changes for now.

Thanks, I will wait for the update.

@joao-r-reis
Copy link
Collaborator

Sorry for the huge delay but we're finally upgrading the .NET versions on our test projects and build infrastructure and I've confirmed this fix works 👍

Copy link
Collaborator

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just let CI run and will merge afterwards.

@joao-r-reis joao-r-reis merged commit d1ab72a into datastax:master Feb 22, 2024
@joao-r-reis joao-r-reis added this to the 3.20.1 milestone Mar 8, 2024
@joao-r-reis joao-r-reis changed the title Add Guid operators for CqlFunction CSHARP-1007 Add Guid operators for CqlFunction Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants