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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsolete SetMemoryAllocator builder extensions #154

Merged
merged 4 commits into from
Apr 23, 2021

Conversation

deanmarcussen
Copy link
Collaborator

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 馃懏.
  • I have provided test coverage for my change (where applicable)

Description

Obsoletes SetMemoryAllocator (from #152) - that's caused me confusion in the past before too :)

I was going to remove the comments, but then stylecop doesn't like it.

Could update them to mention the obsolete message if preferable?

Could also just remove them, instead of obsolete...

@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #154 (2ed89bb) into master (d055952) will increase coverage by 0.24%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #154      +/-   ##
==========================================
+ Coverage   84.57%   84.82%   +0.24%     
==========================================
  Files          46       46              
  Lines        1368     1364       -4     
  Branches      177      177              
==========================================
  Hits         1157     1157              
+ Misses        163      159       -4     
  Partials       48       48              
Flag Coverage 螖
unittests 84.82% <0.00%> (+0.24%) 猬嗭笍

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage 螖
...DependencyInjection/ImageSharpBuilderExtensions.cs 80.30% <0.00%> (+4.58%) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update d055952...2ed89bb. Read the comment docs.

@@ -65,7 +65,7 @@ public static IImageSharpBuilder SetMemoryAllocator(this IImageSharpBuilder buil
/// <param name="builder">The core builder.</param>
/// <returns>The <see cref="IImageSharpBuilder"/>.</returns>
[Obsolete("Use ImageSharp.Configuration.MemoryAllocator. This will be removed in a future version.")]
Copy link
Member

Choose a reason for hiding this comment

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

Should we make this an error instead? Otherwise I think we should keep the implementation to not break the usage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as far as I can tell the current implementation would just register something in the DI, that is never retrieved, i.e. used.

So the only breaking, that I could think of with it, is if a user was using it as a convenience method to register a TMemoryAllocator and also then retrieving it from DI for their own purposes.

So here I just make it a noop instead.

But if you can think of another scenario?

Copy link
Member

Choose a reason for hiding this comment

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

I did not check the implementation details. Just noticed that the code was removed but would not break the build. I am still wondering if we should add Error = true to make sure the user changes their code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I get the suggestion now. Up to your preference really.

The code that is removed didn't do anything (hasn't done for a long time I suspect), so it is questionably / technically an error to call it.

I tend more towards not breaking builds / forcing users to change code where possible, so didn't go with error.

But as you prefer?

Copy link
Member

Choose a reason for hiding this comment

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

Will leave this up to @JimBobSquarePants to decide.

Copy link
Member

Choose a reason for hiding this comment

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

I have less sense than you both so would have just deleted it. :)

I doubt anyone is using this since it doesn't do anything other than provide a convenient way to register an allocator for their own usage. Lets make it an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now I just want to delete it too ;)

Changed to Error

@JimBobSquarePants
Copy link
Member

It鈥檒l be a few days til I can look at this. Sick at the moment with oral shingles.

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

Successfully merging this pull request may close these issues.

None yet

3 participants