Skip to content

Upgrade AsyncGenerator to 0.17.1 #2182

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

Merged
merged 20 commits into from
Sep 29, 2019

Conversation

maca88
Copy link
Contributor

@maca88 maca88 commented Jun 18, 2019

The version contains the fix for the issue discovered in #2056.

It also adds .Net Core support, and this PR switches the generation target framework to netcoreapp for better cross-platform development support.

@@ -3,6 +3,8 @@
targetFramework: net461
concurrentRun: true
applyChanges: true
suppressDiagnosticFailures:
- pattern: ^.*(Hql\.g).*$
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new version of Roslyn reports warnings for Hql.g, which have to be omitted.

@bahusoid
Copy link
Member

It seems .NET Core support is also added in this version. Shouldn't we start using it right away? ) It's my understanding it would allow to skip installing mono for development process on Unix.

@maca88
Copy link
Contributor Author

maca88 commented Jun 18, 2019

Shouldn't we start using it right away?

Yes we could, the only reason I didn't use it is because the minimal .NET Core version is higher than what NHibernate has (netcoreapp2.1 vs netcoreapp2.0). If you are fine with that I will change it to .NET Core.

It's my understanding it would allow to skip installing mono for development process on Unix.

.NET Core would need to be installed instead.

@bahusoid
Copy link
Member

because the minimal .NET Core version is higher than what NHibernate has (netcoreapp2.1 vs netcoreapp2.0). If you are fine with that I will change it to .NET Core.

I personally see no issues with that. But maybe I don't understand all the implications.

@maca88
Copy link
Contributor Author

maca88 commented Jun 18, 2019

The only implication is that a developer with .NET Core 2.0 installed would be able to build the project but not able to generate the async code. I've changed the nant build to use .NET Core, ShowBuildMenu.sh still needs to be changed, which I plan to do it tomorrow.

@hazzik
Copy link
Member

hazzik commented Jun 18, 2019

@maca88, I was thinking about having a dotnet global tool. Is it feasible?

@hazzik
Copy link
Member

hazzik commented Jun 19, 2019

Hi, I'm having issue on MacOS:

hazzik-mac:src hazzik$ dotnet ../Tools/CSharpAsyncGenerator.CommandLine.0.16.0/tools/netcoreapp2.1/AsyncGenerator.CommandLine.dll
21:59:58,517 INFO  CommandLine: AsyncGenerator

21:59:59,150 INFO  AsyncCodeGenerator: Generating async code started
21:59:59,559 INFO  AsyncCodeGenerator: Opening project '/Users/hazzik/Projects/nhibernate-core/src/NHibernate/NHibernate.csproj' started
22:00:02,021 FATAL CommandLine: System.InvalidOperationException: One or more errors occurred while opening the project:
Msbuild failed when processing the file '/Users/hazzik/Projects/nhibernate-core/src/NHibernate/NHibernate.csproj' with message: /usr/local/share/dotnet/sdk/3.0.100-preview4-011223/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.TargetingPackResolution.targets: (84, 5): The "ResolveFrameworkReferences" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'NuGet.Frameworks, Version=5.0.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'NuGet.Frameworks, Version=5.0.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at Microsoft.NET.Build.Tasks.ResolveFrameworkReferences.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 35
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)


Hint: For suppressing irrelevant errors use SuppressDiagnosticFailures option.
   at AsyncGenerator.AsyncCodeGenerator.CheckForErrors(MSBuildWorkspace workspace, String itemType, ImmutableArray`1 supressFailuresPredicates, ILogger logger)
   at AsyncGenerator.AsyncCodeGenerator.OpenProject(MSBuildWorkspace workspace, String filePath, ImmutableArray`1 supressFailuresPredicates, ILogger logger, CancellationToken cancellationToken)
   at AsyncGenerator.AsyncCodeGenerator.GenerateAsync(AsyncCodeConfiguration configuration, CancellationToken cancellationToken)
   at AsyncGenerator.CommandLine.Program.Main(String[] args)

@hazzik
Copy link
Member

hazzik commented Jun 19, 2019

These work fine:

mono ../Tools/CSharpAsyncGenerator.CommandLine.0.16.0/tools/net461/AsyncGenerator.CommandLine.exe
mono ../Tools/CSharpAsyncGenerator.CommandLine.0.16.0/tools/net472/AsyncGenerator.CommandLine.exe

@hazzik
Copy link
Member

hazzik commented Jun 19, 2019

ok, this seems to be an issue with the dotnet sdk version. I wonder how can we fix it?

@hazzik
Copy link
Member

hazzik commented Jun 19, 2019

Works for SDK 2.1.700.

Does not work for SDK 2.2.300:

hazzik-mac:src hazzik$ dotnet new globaljson --sdk-version 2.2.300 --force
The template "global.json file" was created successfully.
hazzik-mac:src hazzik$ dotnet ../Tools/CSharpAsyncGenerator.CommandLine.0.16.0/tools/netcoreapp2.1/AsyncGenerator.CommandLine.dll
22:22:57,813 INFO  CommandLine: AsyncGenerator

22:22:58,321 INFO  AsyncCodeGenerator: Generating async code started
22:22:58,689 INFO  AsyncCodeGenerator: Opening project '/Users/hazzik/Projects/nhibernate-core/src/NHibernate/NHibernate.csproj' started
22:22:59,978 FATAL CommandLine: System.InvalidOperationException: One or more errors occurred while opening the project:
Msbuild failed when processing the file '/Users/hazzik/Projects/nhibernate-core/src/NHibernate/NHibernate.csproj' with message: /usr/local/share/dotnet/sdk/2.2.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets: (208, 5): Error reading assets file: Error loading lock file '/Users/hazzik/Projects/nhibernate-core/src/NHibernate/obj/project.assets.json' : Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.

Hint: For suppressing irrelevant errors use SuppressDiagnosticFailures option.
   at AsyncGenerator.AsyncCodeGenerator.CheckForErrors(MSBuildWorkspace workspace, String itemType, ImmutableArray`1 supressFailuresPredicates, ILogger logger)
   at AsyncGenerator.AsyncCodeGenerator.OpenProject(MSBuildWorkspace workspace, String filePath, ImmutableArray`1 supressFailuresPredicates, ILogger logger, CancellationToken cancellationToken)
   at AsyncGenerator.AsyncCodeGenerator.GenerateAsync(AsyncCodeConfiguration configuration, CancellationToken cancellationToken)
   at AsyncGenerator.CommandLine.Program.Main(String[] args)

@maca88
Copy link
Contributor Author

maca88 commented Jun 19, 2019

I was thinking about having a dotnet global tool. Is it feasible?

I also thought about it but then I realized that it would not work as a specific version may be required for a repository (NHibernate.Caches) or branch (5.2.x) if installed as a global tool. Recently, I found out that in .NET Core 3 will be possible to have a tool installed locally (source search for "Upcoming changes in .NET Core 3.0"), which is ideal for this tool. I will check what has to be done and try to add support for it.

@maca88
Copy link
Contributor Author

maca88 commented Jun 19, 2019

this seems to be an issue with the dotnet sdk version. I wonder how can we fix it?

In .NET Core 2.2 Json.Newtonsoft was updated from v9 to v10 and for some reason there is no redirect to the new version. I've made a fix by adding a redirect (maca88/AsyncGenerator/pull/128).

@maca88 maca88 changed the title Upgrade AsyncGenerator to 0.16.0 Upgrade AsyncGenerator to 0.16.1 Jun 19, 2019
@maca88
Copy link
Contributor Author

maca88 commented Jun 19, 2019

@hazzik can you please verify if the current code works on MacOS?

@maca88
Copy link
Contributor Author

maca88 commented Jun 19, 2019

The current code does not compile on net461 and to resolve the problem maca88/AsyncGenerator/issues/129 must be resolved, which I plan to do it tomorrow.

@maca88 maca88 changed the title Upgrade AsyncGenerator to 0.16.1 WIP - Upgrade AsyncGenerator to 0.16.1 Jun 19, 2019
@maca88 maca88 changed the title WIP - Upgrade AsyncGenerator to 0.16.1 Upgrade AsyncGenerator to 0.16.2 Jun 21, 2019
@maca88 maca88 mentioned this pull request Sep 9, 2019
@maca88 maca88 changed the title Upgrade AsyncGenerator to 0.16.2 Upgrade AsyncGenerator to 0.17.0 Sep 10, 2019
Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

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

When re-generatig async (under Windows, latest VS 2017 (15.9.16), no VS 2019), the obsolete class FutureBatch lose its GetResultsAsync member, causing compilation failures.

@maca88

This comment has been minimized.

@fredericDelaporte

This comment has been minimized.

@maca88
Copy link
Contributor Author

maca88 commented Sep 25, 2019

Upgraded to version 0.17.1, which fixes the issue with FutureBatch and rebased to master.

@maca88 maca88 changed the title Upgrade AsyncGenerator to 0.17.0 Upgrade AsyncGenerator to 0.17.1 Sep 25, 2019
@fredericDelaporte

This comment has been minimized.

@bahusoid
Copy link
Member

Otherwise some distribution of Roslyn may omit the English localization and then the switch would not be honored.

English resource is embedded into project (see resource and project). And translations are provided as satellite assemblies. So I don't think that English localization can be omitted somehow.

@maca88

This comment has been minimized.

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.

4 participants