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

Binary API Breaking Change in 108.0.2 #1953

Closed
GKBelmonte opened this issue Nov 1, 2022 · 11 comments
Closed

Binary API Breaking Change in 108.0.2 #1953

GKBelmonte opened this issue Nov 1, 2022 · 11 comments
Labels

Comments

@GKBelmonte
Copy link

Describe the bug
The following change:
c969747?diff=split#diff-fd5240c0eeb1a04bc0c9ea9b5210c8a8ce6703011459c72d49ee4b0c08e61224R292

Introduces a default parameter to a number of extensions (FileParameterOptions? options = null)
Binaries previously compiled against the old version (lacking the default arg) will fail to find the method at runtime.

(see this answer on SO)

What will result, will be a runtime binding exception:

System.MissingMethodException: Method not found: 'RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String)'.

To Reproduce

  1. Compile an assembly A using the method without the new default option (108.0.1)
    a. Expose that code path
  2. Create a new project that depends on both that assembly and uses 108.0.2
  3. Call the code path exposed in 1.a

Expected behavior
The method works succesfully

Stack trace
n/a

Desktop (please complete the following information):
n/a

Additional context
It is important that the assembly produced in step 1 is referenced as binary not as source (project), since its a binary breaking change, not a source breaking change.

The code of the assembly A would still compile, if REcompiled against version 108.0.2, it is the runtime binding that would fail.

@GKBelmonte GKBelmonte added the bug label Nov 1, 2022
@alexeyzimarev
Copy link
Member

You're right. I would gladly accept a PR where the method is reverted, and the new overloaded is added with options. Then, I can release it as a minor under 108.

@GKBelmonte
Copy link
Author

I can do that after work :)

@alexeyzimarev
Copy link
Member

It wasn't as easy as I expected because of the optional parameters. So, it will be one more breaking change, but the impact would be only on people who use the options, and I don't think this feature is widely used.

@GKBelmonte
Copy link
Author

ah thanks!
I was looking at it yesterday, but turns out I didnt have the right VS installed, so I started download overnight.

@alexeyzimarev
Copy link
Member

No worries, I hope I can release it soon, so you can try.

@alexeyzimarev
Copy link
Member

Btw you can try the latest preview to make sure it works as expected.

@GKBelmonte
Copy link
Author

Hey Alexey!
Tried it locally, and it seems to work !

I may have to try with a full open API gen with dotnet core, but at the very least locally it, with a binary ref and a proj ref, it works!

@alexeyzimarev
Copy link
Member

Noice, I will tag that version and release it.

@SamInfosoft
Copy link

I am getting this using Xero XeroAPI/Xero-NetStandard#472
I suspect this fix didn't work. (using restsharp 110.2.0
Rolling back to 108.0.1 fixes it.

@Jacko1394
Copy link

On 110.2.0 I also got this error while using Xero.NetStandard.OAuth2Client (1.6.0)

@alexeyzimarev
Copy link
Member

@Jacko1394 v110 is a major version so it is not expected to be binary compatible.

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

4 participants