bcssov / IronyModManager

Mod Manager for Paradox Games. Official Discord: https://discord.gg/t9JmY8KFrV
https://bcssov.github.io/IronyModManager/
MIT License
346 stars 41 forks source link

Upgrade to GameFinder 3 #439

Closed erri120 closed 1 year ago

bcssov commented 1 year ago

Thanks

bcssov commented 1 year ago

Sorry, going to have to revert this as the build fails. Using strongnamer I currently don't have time do dig deeper. Failed to write signed assembly to '\net7.0\SignedAssemblies\NexusMods.Paths.dll'. Mono.Cecil.ResolutionException: Failed to resolve System.IO.FileAccess

erri120 commented 1 year ago

I've never used StrongNamer, but I'm both author of GameFinder and developer of NexusMods.Paths, so I'll take a look.

bcssov commented 1 year ago

Here's a repro for you.

ConsoleApp1.zip

1>Failed to write signed assembly to '\net7.0\SignedAssemblies\NexusMods.Paths.dll'. Mono.Cecil.ResolutionException: Failed to resolve System.IO.FileAccess
1>   at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
1>   at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)
1>   at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
1>   at Mono.Cecil.MetadataBuilder.AddParameter(UInt16 sequence, ParameterDefinition parameter, ParamTable table)
1>   at Mono.Cecil.MetadataBuilder.AddParameters(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildModule()
1>   at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>   at StrongNamer.AddStrongName.ProcessAssembly(ITaskItem assemblyItem, Byte[] keyBytes, StrongNamerAssemblyResolver resolver)
1>CSC : error CS0006: Metadata file 'net7.0\SignedAssemblies\NexusMods.Paths.dll' could not be found
erri120 commented 1 year ago

Just out of curiosity, why are you using strong-named assemblies? The MS docs say it's basically useless in .NET Core and .NET 5+: https://learn.microsoft.com/en-us/dotnet/standard/assembly/strong-named

bcssov commented 1 year ago

There are still benefits. But the reason why it was used was as a placeholder; as a part of a better future security to prevent the program to load non validated binaries. Community feedback and general project direction lead elsewhere. Program loads dynamically some assemblies (and validates them) with theoretical plugin support so at the very least I wanted some rudimentary validation.

On a side note I'm a bit concerned about this package that throws the exception being under GPL license my project is MIT licensed and so far I've avoided packages with GPL license.

erri120 commented 1 year ago

Here's a repro for you.

ConsoleApp1.zip

1>Failed to write signed assembly to '\net7.0\SignedAssemblies\NexusMods.Paths.dll'. Mono.Cecil.ResolutionException: Failed to resolve System.IO.FileAccess
1>   at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
1>   at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)
1>   at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
1>   at Mono.Cecil.MetadataBuilder.AddParameter(UInt16 sequence, ParameterDefinition parameter, ParamTable table)
1>   at Mono.Cecil.MetadataBuilder.AddParameters(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildModule()
1>   at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>   at StrongNamer.AddStrongName.ProcessAssembly(ITaskItem assemblyItem, Byte[] keyBytes, StrongNamerAssemblyResolver resolver)
1>CSC : error CS0006: Metadata file 'net7.0\SignedAssemblies\NexusMods.Paths.dll' could not be found

I can build and run this test project without any issues. I'm using .NET 7.0.103 on Linux.

bcssov commented 1 year ago

I too can build if I invoke dotnet build. And then subsequently build from within visual studio. But the problem is on a clean solution and build within VS 2022 (that's not very convenient for me).

Feel free to close the issue on your end, thanks for looking into it.

erri120 commented 1 year ago

I too can build if I invoke dotnet build. And then subsequently build from within visual studio. But the problem is on a clean solution and build within VS 2022 (that's not very convenient for me).

Feel free to close the issue on your end, thanks for looking into it.

That's a VS issue. JetBrains Rider works fine, even on clean builds.

bcssov commented 1 year ago

Most likely yeah, which is why I said you can close the ticket on your end.

For me this is still a show stopper, maybe in the future if the issue is resolved by the VS team I'll look into it once again.