GitTools / GitReleaseManager

Tool for creating and exporting releases for software applications hosted on GitHub
https://gittools.github.io/GitReleaseManager/docs/
MIT License
298 stars 39 forks source link

GitReleaseManager doesn't run under .NET 7.0 - need to remove support for .NET 4.8 #530

Closed SimonCropp closed 7 months ago

SimonCropp commented 9 months ago

https://github.com/VerifyTests/Verify/actions/runs/6254973775/job/16983521929

will look into is more and add details as i find them.

[FTL] GenericArguments[0], 'System.DateTimeOffset', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.
System.ArgumentException: GenericArguments[0], 'System.DateTimeOffset', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.
 ---> System.Security.VerificationException: Method System.Linq.Enumerable.MaxInteger: type argument 'System.DateTimeOffset' violates the constraint of type parameter 'T'.
   at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
   --- End of inner exception stack trace ---
   at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
   at AutoMapper.TypeDetails.<>c__DisplayClass28_1.<BuildPublicNoArgExtensionMethods>b__10(MethodInfo extensionMethod)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
   at System.Linq.Enumerable.SelectManyIterator[TSource,TCollection,TResult](IEnumerable`1 source, Func`2 collectionSelector, Func`3 resultSelector)+MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
   at System.Linq.Enumerable.UnionIterator`1.FillSet()
   at System.Linq.Enumerable.UnionIterator`1.ToArray()
   at AutoMapper.TypeDetails.BuildPublicNoArgExtensionMethods(IEnumerable`1 sourceExtensionMethodSearch)
   at AutoMapper.TypeDetails..ctor(Type type, ProfileMap config)
   at AutoMapper.ProfileMap.TypeDetailsFactory(Type type)
   at AutoMapper.Internal.LockingConcurrentDictionary`2.<>c__DisplayClass2_1.<.ctor>b__1()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at AutoMapper.Internal.LockingConcurrentDictionary`2.GetOrAdd(TKey key)
   at AutoMapper.ProfileMap.CreateTypeDetails(Type type)
   at AutoMapper.Configuration.Conventions.NameSplitMember.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String nameToSearch, LinkedList`1 resolvers, IMemberConfiguration parent, Boolean isReverseMap)
   at AutoMapper.Configuration.Conventions.MemberConfiguration.MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, String nameToSearch, LinkedList`1 resolvers, Boolean isReverseMap)
   at AutoMapper.ProfileMap.MapDestinationPropertyToSource(TypeDetails sourceTypeInfo, Type destType, Type destMemberType, String destMemberInfo, LinkedList`1 members, Boolean reverseNamingConventions)
   at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options, Boolean isReverseMap)
   at AutoMapper.ProfileMap.BuildTypeMap(IConfigurationProvider configurationProvider, ITypeMapConfiguration config)
   at AutoMapper.ProfileMap.Register(IConfigurationProvider configurationProvider)
   at AutoMapper.MapperConfiguration.Seal()
   at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
   at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
   at GitReleaseManager.Core.AutoMapperConfiguration.Configure() in /_/src/GitReleaseManager.Core/AutoMapperConfiguration.cs:line 13
   at GitReleaseManager.Cli.Program.RegisterServices(BaseSubOptions options) in /_/src/GitReleaseManager.Cli/Program.cs:line 78
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at GitReleaseManager.Cli.Program.Main(String[] args) in /_/src/GitReleaseManager.Cli/Program.cs:line 34
SimonCropp commented 9 months ago

seems an update to the current of automapper should fix it https://github.com/AutoMapper/AutoMapper/issues/4163

gep13 commented 9 months ago

@SimonCropp hmm, this is an interesting one...

We recently ignored a Dependabot PR to update AutoMapper:

https://github.com/GitTools/GitReleaseManager/pull/509

Since it isn't compatible with the current projects target frameworks.

I would need to dig in and figure out exactly what would be required to get that update in.

What exactly is it that it is falling up on?

pleonex commented 9 months ago

Same happening for me. It's failing to export the release notes (with and without tagName). Downgrading to 0.14.0 works.

Jericho commented 8 months ago

I just experienced this issue as well. If I understand correctly, it seems there's an issue in the older version of AutoMapper we are referencing when used under .net7. The obvious solution is to upgrade to a more recent version of AutoMapper but they dropped support for netstandard2.0, which means that we would need to change <TargetFrameworks>netstandard2.0</TargetFrameworks> in GitReleaseManager.Core.csproj to <TargetFrameworks>netstandard2.1</TargetFrameworks>.

Another possibility could be to pin the .NET SDK to 6.x.x. I haven't tried this because I no longer have .NET SDK version 6 installed on my laptop.

To be clear: I only experience this on my laptop, not on the CI environment. I suspect the difference is that .NET 6 is not on my machine while it probably is installed in the CI environment.

Jericho commented 8 months ago

I upgraded AutoMapper to the latest release and this had the following consequences:

If loosing compatibility with net48 is not desirable, maybe we could look into my previous suggestion of pinning the .NET SDK to version 6. However, I don't see this as a long term solution because sooner of later we'll want to upgrade the SDK. Otherwise, maybe we could look into switching to an alternative mapping nuget package?

@gep13 I'm more than willing to investigate further and to submit a PR but I need some direction. Do you think dropping net48 is acceptable? If not, should I investigate pinning the SDK or should I search for an alternative to AutoMapper?

Jericho commented 8 months ago

I went ahead and installed .NET 6 SDK on my machine and to my surprise the problem went away! I didn't even have to pin the SDK or change anything else. It seems like the root of the problem is that only .NET 7 was installed on my machine.

Here's what dotnet --info says: image

Notice that 6.0.416 is now listed, that wasn't the case until earlier this morning.

As far as I'm concerned, this is an acceptable solution which allows me to move forward. I don't think any other changes are necessary.

mkevenaar commented 7 months ago

Same here.

GHA Runner logs, if required: https://github.com/mkevenaar/php_print_ipp/actions/runs/6811642874/job/18522396621#step:10:93

gep13 commented 7 months ago

Myself and @AdmiringWorm met today to discuss this, and what we thought would be the course of action. We have come up with a plan that we think will work, but we are also happy to take some feedback if folks think there are other things to discuss...

Long story short, we still want to have both a .NET Global Tool version, and a Chocolatey package version of GitReleaseManager. Given the requirement to update to the latest version of AutoMapper, this means that we lose support for .NET Standard 2.0, and instead need to use at least .NET Standard 2.1. If we do that, we can no longer use .NET Framework 4.8. And it we do that, we lose the ability to create an application that will work directly on Windows via the Chocolatey package.

So, having said all of that, here is the plan...

Switch the projects to target the following:

Projet Target Frameworks
Cli net6.0
Tool net6.0 and net7.0
Core net6.0 and net7.0

The Cli project will then switch to creating a Standalone Application, which will. then be bundled into the Chocolatey Package, and be deployed from there. To allow this to work as expected, the nuspec file will be updated to remove the dependency on the .NET 4.8 package.

The release notes will need to be updated to make this change clear, to ensure that everyone is aware of the change.

Jericho commented 7 months ago

Quick update: I'm experiencing this problem again on my machine despite the fact that installing .NET6 seemed to have fixed the problem a few days ago.

This highlights the fact that the only long term solution is what is being implemented in PR #545.

gittools-bot commented 7 months ago

:tada: This issue has been resolved in version 0.16.0 :tada:

The release is available on:

Your GitReleaseManager bot :package::rocket: