Skip to content

Conversation

@iamcarbon
Copy link
Contributor

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

@iamcarbon
Copy link
Contributor Author

Waiting for the VS2019 images to land on CI.

<DebugSymbols>True</DebugSymbols>
<Features>IOperation</Features>
<LangVersion>7.3</LangVersion>
<LangVersion>preview</LangVersion>
Copy link
Member

Choose a reason for hiding this comment

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

This could be an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works with the v2.2.202 of the dotnet SDK that just got published. And will also work when the Visual Studio 2019 images go live.

Copy link
Member

Choose a reason for hiding this comment

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

@dlemstra noticed an issue with the "wildcard" settings. Can't remember what it was, but we decided to go explicit. Even without understanding it, it seems safer to me if we want interop across different IDE-s / SDK-s.

@antonfirsov antonfirsov marked this pull request as ready for review April 7, 2019 15:40
@antonfirsov
Copy link
Member

I pressed "ready for review" accidentally.

appveyor.yml Outdated
@@ -1,5 +1,5 @@
version: 1.0.0.{build}
image: Visual Studio 2017
image: Visual Studio 2019 Preview
Copy link
Member

Choose a reason for hiding this comment

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

This is just an enabler for C# 8.0, leaving target_framework compatibility untouched. Is my understanding correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. We don't need to touch the target frameworks. I have things compiling locally -- just waiting on AppVeyor to update now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Things look good on Travis.

@iamcarbon iamcarbon changed the title Update to VS2019 Update to VS2019 + Use C# 8.0 Apr 7, 2019
@iamcarbon iamcarbon changed the title Update to VS2019 + Use C# 8.0 Update to VS2019 + Use C# 8.0 [Blocked] Apr 7, 2019
// The compression value in OS/2 bitmap has a different meaning than in windows bitmaps.
// Map the OS/2 value to the windows values.
switch (compression)
infoHeader.Compression = compression switch
Copy link
Member

Choose a reason for hiding this comment

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

Damn that's nice!

@iamcarbon
Copy link
Contributor Author

And we've landed!

@codecov
Copy link

codecov bot commented Apr 19, 2019

Codecov Report

Merging #872 into master will decrease coverage by 0.02%.
The diff coverage is 7.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #872      +/-   ##
==========================================
- Coverage   88.97%   88.94%   -0.03%     
==========================================
  Files        1018     1018              
  Lines       44579    44543      -36     
  Branches     3234     3245      +11     
==========================================
- Hits        39663    39620      -43     
+ Misses       4195     4187       -8     
- Partials      721      736      +15
Impacted Files Coverage Δ
src/ImageSharp/Formats/Bmp/BmpInfoHeader.cs 70.21% <0%> (-0.92%) ⬇️
src/ImageSharp/Formats/Png/Adam7.cs 26.66% <0%> (-57.95%) ⬇️
...ta/Profiles/ICC/DataReader/IccDataReader.Curves.cs 78.04% <20%> (-8.38%) ⬇️
...ssing/Processors/Transforms/AutoOrientProcessor.cs 80.64% <0%> (-0.61%) ⬇️
...CC/DataReader/IccDataReader.MultiProcessElement.cs 90% <0%> (-0.48%) ⬇️
...Processing/Processors/Transforms/TransformUtils.cs 93.25% <0%> (-0.36%) ⬇️
...on/Implementation/Converters/HsvAndRgbConverter.cs 89.65% <0%> (-0.18%) ⬇️
src/ImageSharp/Common/Helpers/ImageMaths.cs 87.01% <0%> (-0.17%) ⬇️
src/ImageSharp/Processing/DetectEdgesExtensions.cs 96.42% <0%> (-0.13%) ⬇️
... and 13 more

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 5a85ea7...bb49570. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 19, 2019

Codecov Report

Merging #872 into master will decrease coverage by 0.03%.
The diff coverage is 18.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #872      +/-   ##
==========================================
- Coverage   89.02%   88.98%   -0.04%     
==========================================
  Files        1024     1024              
  Lines       44786    44792       +6     
  Branches     3230     3255      +25     
==========================================
- Hits        39872    39860      -12     
+ Misses       4202     4195       -7     
- Partials      712      737      +25
Impacted Files Coverage Δ
src/ImageSharp/Formats/Bmp/BmpInfoHeader.cs 70.21% <0%> (-0.71%) ⬇️
src/ImageSharp/Image.FromFile.cs 78.26% <0%> (ø) ⬆️
src/ImageSharp/Formats/Png/Adam7.cs 26.66% <0%> (-65%) ⬇️
src/ImageSharp/Image.FromStream.cs 60% <100%> (ø) ⬆️
src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs 94.71% <100%> (ø) ⬆️
...ta/Profiles/ICC/DataReader/IccDataReader.Curves.cs 78.04% <20%> (-8.03%) ⬇️
src/ImageSharp/Formats/Png/PngEncoderCore.cs 93.53% <66.66%> (ø) ⬆️

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 87c0a66...29549de. Read the comment docs.

@iamcarbon
Copy link
Contributor Author

iamcarbon commented Apr 19, 2019

And now travis is broke. Hahah.

EDIT: Seems to be a known bug. Going to try a different Linux version.

@iamcarbon
Copy link
Contributor Author

Success! Ready for review. CC @JimBobSquarePants @antonfirsov

This enables use to use static local functions, switch expressions, nullable reference types, and disposable ref structs.

Some additional features are enabled using the preview lang-version but I think these are still being worked on and will be enabled in an upcoming SDK.

@iamcarbon iamcarbon changed the title Update to VS2019 + Use C# 8.0 [Blocked] Update to VS2019 + Use C# 8.0 Apr 20, 2019
@iamcarbon iamcarbon changed the title Update to VS2019 + Use C# 8.0 Update SDKs and use C# 8.0 Apr 20, 2019
Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

I think we need to get the VS2019 part merged ASAP, but I have a simple concern regarding C# 8.0:
what if other contributors (with open PR-s) haven't switched yet?

Let's think this over, maybe it would be wiser to wait a few more weeks with the language version change!

@dlemstra @tocsoft @brianpopow @vpenades @jongleur1983 @Sergio0694 please share your thoughts!

@vpenades
Copy link
Contributor

@antonfirsov I'm still using 2017. At home I'll probably switch to 2019 next week. At work it'll take a couple months. But it's fine since I'm only doing things with the source code of imagesharp at home.

I know some people that is waiting to switch to 2019 when NetCore 3 is released. This makes some sense since 2019 is required for NetCore 3, and it's what people actually want to target.

Another matter is if you're exposing C# 8 characteristics in the public API. In my experience, I've been using C# 7.3 "in" and "unmanaged" keywords. Nuget packages that target C# 7.3 can be consumed by c# 7.0 projects as long as you don't call any method using higher level features, in that case, it will throw an exception.

@Sergio0694
Copy link
Member

Sergio0694 commented Apr 21, 2019

I already have VS2019 + .NET Core 3.0 preview on my PC, so this wouldn't be a breaking change for me personally (as far as working on the repo itself goes). But:

  • I agree with those who said that VS2019 is not that widespread yet, as many users are waiting for the final .NET Core 3.0 version to be released before upgrading. This would break the repo for them until they switch.
  • I don't need any particular C# 8.0 features in my bokeh processor, so regarding my open PR in particular, this is fine either way.
  • Considering that ImageSharp can't even build on UWP right now, I'm a bit scared switching to a language preview version could mess things up even more there. 🙈
    By that I mean, while some C# 8.0 features are basically just syntactic sugar (eg the switch statement), other actually require some runtime support, and I'm not sure how that'd play out for frameworks that right now don't officially support those (eg. UWP, or .NET Framework).

Just thinking out loud here 😄

@dlemstra
Copy link
Member

I am one of the people that will switch to 2019 after NetCore 3 has been released. But if there are more people who will want to switch already then feel free to do so. If the switch is made earlier I can always spin up a VM in Azure and install VS2019 on there and work from there.

@JimBobSquarePants
Copy link
Member

I'm reading a little confusion here...

.NET Core 3.0 and C#8 should be considered independantly. VS2019 does not mean we require .NET Core 3.0 nor should it be a consideration when choosing to move from 2017. Bug fixes, faster compilation, better refactorings etc should be your consideration here.

We also should not be concerned by certain C#8 features not being availabe on .NET Framework. We specifically target the framework so if something doesn't work the build will simply fail.

That said, I agree with @antonfirsov here. I think we should split this PR into two.

  1. Build configuration changes updating the image to VS2019. This fixes issues we are having with Travis and also speeds up our build/test times on Appveyor. We should merge those changes as soon as possible as our builds are blocked!
  2. Update the language version. We should be a lot more careful here and carefully consider where we make changes (no public APIs). I say hold off on this for now until we have a clearer picture of any possible side effects and a plan to update the whole suite of libraries.

@tannergooding You're our man on the inside. Does this make sense to you?

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

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

See below for my thought. Thanks!

#872 (comment)

@tannergooding
Copy link
Contributor

@JimBobSquarePants, that makes sense to me.

VS2019 is released and supported, you should feel free to move to it as you would any new version. Community edition can also be used for contributing to open source projects, so I don't believe moving to it will block anyone.

C# 8 and .NET Core 3 are both still in preview and being worked on. If you want to support these, there are ways you can configure the infrastructure to require a minimum SDK version already be on box or for your build.{cmd|sh} script to pull it down locally from the internet (similarly to CoreFX, CoreCLR, Roslyn, and other projects). There will likely be more information released at Microsoft Build, and it may be good to wait until then before making a decision here.

@jongleur1983
Copy link
Contributor

I still don't use ImageSharp in any projects, just contributing for fun. I'm on VS2019 at home and at work already, but did not yet switch to C#8 anywhere (but I'm fine with doing so).

@Sergio0694
Copy link
Member

@JimBobSquarePants In case that "I see some confusion here" also referred to my answer, just to clarify, what I meant is that while I'm aware the VS2019 is completely independent from .NET Core 3.0 and C# 8.0, from what I saw lots of users are just waiting for .NET Core 3.0 to be publicly released before bothering to upgrade from VS2017.
And in that case, those users would no longer be able to contribute to the repo if we start to integrate C# 8.0 features, as those aren't available on VS2017.

Then of course, you could still go ahead with the C# 8.0 integration and eventually just force those users to upgrade to VS2019 now, I'm not saying that'd be a bad thing per se 😄

As far as I'm concerned, my only fear regarding C# 8.0 is how it'll play out with the .NET Native compiler on UWP, which as you well know, already just fails to compile ImageSharp.

@brianpopow
Copy link
Collaborator

I am using VS2019 at home and at work, so i am fine with that. I also have no objection in switching to C# 8.0

@antonfirsov
Copy link
Member

antonfirsov commented Apr 22, 2019

@JimBobSquarePants wow, actually I wanted to accept the changes based on the positive responses from the community, but let's do the split then! 😄

I will open a separate PR copying the SDK changes from this one very soon.

Update: Done in #891

@antonfirsov antonfirsov mentioned this pull request Apr 22, 2019
4 tasks
@iamcarbon
Copy link
Contributor Author

Let's revisit this again soon.

@iamcarbon iamcarbon closed this Apr 23, 2019
@JimBobSquarePants
Copy link
Member

Thanks all for your contribution to the discussion. It's really great to read your input!

@iamcarbon I'm very keen on moving to C# 8. There's some stuff in there that I really like the look of that could be very useful to us. I just want to be cautious and work with a proper plan. ImageSharp is the end of a dependency chain and I think we should begin any migration efforts at Core so we can dogfood our changes as they propegate through that chain.

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

Successfully merging this pull request may close these issues.

9 participants