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

net6.0, Ambiguous reference: System.Collections.Generic.IAsyncEnumerable #633

Closed
wdolek opened this issue Mar 29, 2023 · 9 comments
Closed
Assignees
Labels

Comments

@wdolek
Copy link
Contributor

wdolek commented Mar 29, 2023

  1. What version of .NET driver are you using?

Snowflake.Data 2.0.22

  1. What operating system and processor architecture are you using?

Windows 10 (development), containerized Linux (runtime)

  1. What version of .NET framework are you using?

net6.0

  1. What did you do?

I want to use IAsyncEnumerable<> in my program but getting compiler error.

  1. What did you expect to see?

No compiler error 🤷


I'm getting compiler error when trying to declare method like this in my program:

public async IAsyncEnumerable<string> Fetch()
{
    throw new NotImplementedException();
}
Ambiguous reference: System.Collections.Generic.IAsyncEnumerable<out string> System.Collections.Generic.IAsyncEnumerable<out string> match
LeCode.cs(42, 42): [CS0433] The type 'IAsyncEnumerable<T>' exists in both 'System.Interactive.Async, Version=3.2.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' and 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

This is apparently caused by dependency chain:

Dependency on Google.Cloud.Storage.V1 has been added in [email protected], ~year ago.

Related issue: #623.


Would it be possible to (and/or):

  • update dependency on Google.Cloud.Storage.V1
  • extract cloud specific code into separate library (e.g. Snowflake.Data.Azure, Snowflake.Data.Aws, Snowflake.Data.Gcp, ... I'm not sure whether all three are needed at same time)

I just stumbled on this issue while maintaining one of our older projects. I can't really tell what impact bumping up dependency will have, not to mention impact on other older framework versions. Unfortunately I won't be able to submit PR nor investigate further myself.

@wdolek wdolek added the bug label Mar 29, 2023
@plaisted
Copy link

Adding an explicit reference to version 4.4.0 seems to resolve the issue (<PackageReference Include="Google.Cloud.Storage.V1" Version="4.4.0" />) although not great since we aren't even using Google Cloud.

@sfc-gh-igarish sfc-gh-igarish added the status-in_progress Issue is worked on by the driver team label May 26, 2023
@sfc-gh-dszmolka
Copy link
Contributor

thank you for raising this issue, we'll take a look

@mahdi-openup
Copy link

Any updates on it?

@sfc-gh-dszmolka
Copy link
Contributor

not at this point, but if anything will be available I'll post it here

@sfc-gh-dszmolka
Copy link
Contributor

thank you all for the patience here, fix is merged in #712 and will be part of the next upcoming release in July

@sfc-gh-dszmolka sfc-gh-dszmolka added status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. and removed status-in_progress Issue is worked on by the driver team labels Jul 21, 2023
@sfc-gh-dszmolka
Copy link
Contributor

PR is released as part of the latest Snowflake .NET driver version 2.1.0. Closing this issue.

@sfc-gh-dszmolka sfc-gh-dszmolka removed the status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. label Jul 27, 2023
@julealgon
Copy link

I just lost around 2h of investigation time because of this insane dependency with Google.Cloud which in turn ends up depending on System.Interactive.Async that on older versions creates a conflict with System.Linq.Async.

Why on earth does this library depend on a Google.Cloud package in the first place?

@sfc-gh-dszmolka
Copy link
Contributor

sorry to hear the tightly coupled dependencies caused a headache to you. currently this library depends on all 3 cloud providers even if you're not using it on a particular CP.

that one is handled in #517 / #612

@julealgon
Copy link

@sfc-gh-dszmolka I realized why the dependency was there after cloning this repo and attempting to remove it. At first, I thought it was only being used indirectly to get to the Google Auth API, but no... the direct references are there.

I'm really glad you at least seem open to the idea of a redesign here where these external cloud dependencies would be moved into specialized packages that people can add depending on their use case.

We are in a very particular situation in terms of framework versions and library dependencies in our project and we (currently) cannot easily migrate away from v2.x of this library. V2 depends on this older version of the Google stuff, which depends on System.Interactive.Async and this caused this really hard to debug problem for us.

Hopefully this library will become less coupled in the future and we will be able to migrate to a modern release.

I appreciate your reaction to my harsh comment before. Even though I was really pissed off after finally finding a solution to the issue, I apologize for the unnecessary tone there.

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

No branches or pull requests

8 participants