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

Breaking Changes Due to Addition of Optional CancellationToken Parameters #506

Closed
nathanaw opened this issue Jun 30, 2021 · 0 comments
Closed

Comments

@nathanaw
Copy link

Expected Behavior

Binary backwards compatibility within a major version (Semver)

Current Behavior

The addition of optional parameters in releases after 2.2.0 make the packages incompatible.

Possible Solution

A two step change:

  1. Add overloads that do not include the new optional parameters to maintain binary backwards compatibility.
  2. Change the methods (which accept the optional cancellation token) so that the cancellation token parameter is not optional.

This should be backward compatible with both 2.2.x and 2.3.x.

Steps to Reproduce

  1. Create a library "foo" compiled against SqlKata version 2.2.0. Use GetAsync() method.
  2. Create an application "bar" that uses library "foo", and references SqlKata 2.3.x
  3. Run application and observe a missing method exception

(See attached below.)

Resulting exception:

System.MissingMethodException
  HResult=0x80131513
  Message=Method not found: 'System.Threading.Tasks.Task`1<System.Collections.Generic.IEnumerable`1<System.Object>> SqlKata.Execution.QueryExtensions.GetAsync(SqlKata.Query, System.Data.IDbTransaction, System.Nullable`1<Int32>)'.
  Source=Foo
  StackTrace:
   at 
Foo.Test.<CallGetAsync>d__0.MoveNext() in C:\src\temp\sqlkata-lib\Foo\Test.cs:line 19
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Foo.Test.CallGetAsync()
   at Foo.Program.<Main>d__0.MoveNext() in C:\src\temp\sqlkata-app\Bar\Test.cs:line 15

Notes

The Fuget tooling provides a quick snapshot between the released packages, showing the API differences:
https://www.fuget.org/packages/SqlKata.Execution/2.3.7/lib/netstandard2.0/diff/2.2.0/

Attached is a sample pair of projects showing the above repro:

sqlkata-breaking-change-sample.zip

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

2 participants