-
Notifications
You must be signed in to change notification settings - Fork 161
Support ASP.NET Core 3.0 #280
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
Support ASP.NET Core 3.0 #280
Conversation
I think this should do it, but @EdgarMaucourant did mention he had issues in GraphQL proper over on the issue, so potentially we need to do a similar thing over in that project. Only thing I needed to toggle with My biggest unknown about all this is can an ASP.NET Core 3.0 app be referencing projects that target |
Few more things to sort out, but getting there slowly... |
So I've got all tests passing except websocket ones on 3.0. Outstanding is:
|
src/Transports.Subscriptions.WebSockets/Transports.Subscriptions.WebSockets.csproj
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, the direction is right.
Hey @sungam3r, ready for another review.
|
|
Found the AppVeyor issue. Fresh eyes. This was the fix. bdd139b I realised that the thing it was complaining about "GraphQL.Samples.Server doesn't support netcoreapp2.0, it's netcoreapp3.0 only" or whatever, was specifically referring to the assembly name in the .csproj, as the project name doesn't include So the last thing here is the WebSockets unit tests still failing. I'm really not across this stuff but I'll have a quick look. @pekkah, sorry to bother, but you seem good at this, mind taking a quick look at it? |
Latest commit gets rid of the 3.0 specific samples server project all together, since I realised all the files were linked anyway... |
It is interesting to observe such an evolution. I was hoping that everything would come down to one sample project with multitargeting. It seems to me that this is better than individual examples. It’s easier to focus and understand the difference between the platforms. |
Boom, got it. Bit painful, but looks like if you call What's next @sungam3r, is this ready for prime time? Did a bit more clean up as I went through all this at least :P |
…sistent brace lines
It's good that everything ended successfully. I will look again later. I don’t think I will have any new comments. |
samples/Samples.Server/Program.cs
Outdated
@@ -1,5 +1,6 @@ | |||
using Microsoft.AspNetCore; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.Extensions.Hosting; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe take using Microsoft.AspNetCore.Hosting;
and using Microsoft.Extensions.Hosting;
under #if / #else too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I wasn't sure what was best practice with that. Will #if/#else them to make it clearer.
samples/Samples.Server/Program.cs
Outdated
public static IWebHostBuilder CreateWebHostBuilder(string[] args) | ||
{ | ||
return WebHost.CreateDefaultBuilder<Startup>(args) | ||
.UseSerilog(); | ||
} | ||
#else | ||
public static IHostBuilder CreateHostBuilder(string[] args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting Ctrl, K + F, only works on current target code. Fixed.
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Hosting; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
under #if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
<PackageReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(MicrosoftAspNetCoreTestHostVersion)" /> | ||
<PackageReference Include="GraphQL" Version="$(GraphQLVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftAspNetCoreMvcTestingVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft.AspNetCore.TestHost
should be enough. There are no any MVC things in this repo. Also no need in MicrosoftAspNetCoreMvcTestingVersion
in Directory.Build.props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
<PackageReference Include="Microsoft.AspNetCore" Version="$(MicrosoftAspNetCoreVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(MicrosoftAspNetCoreTestHostVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="$(MicrosoftAspNetCoreWebSocketsVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftAspNetCoreMvcTestingVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestHost instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
{ | ||
_server.Dispose(); | ||
#if !(NETFRAMEWORK || NETCOREAPP2_2) | ||
_host.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
} | ||
|
||
protected TestServer Server { get; } | ||
|
||
protected HttpClient Client { get; } | ||
|
||
#if !NETCOREAPP2_2 | ||
protected IHost Host { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protected? Any usages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, neither for the two above. All private now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I will be glad to merge this after the final corrections.
It was a good experience migrating to netcoreapp3.0 while maintaining compatibility with the previous platform.
@sungam3r , all feedback addressed. LGTM |
Finally! |
Addresses #276