Skip to content
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

Compilation fails error message with Splat.Drawing.dll'. Mono.Cecil.ResolutionException: Failed to resolve System.Reflection.BindingFlags #59

Open
tapika opened this issue Oct 3, 2021 · 1 comment

Comments

@tapika
Copy link

tapika commented Oct 3, 2021

If you try to use Splat.Drawing nuget package with StrongNamer 0.2.5 on .NET Core 3.1 project - results in compilation error:

1>Failed to write signed assembly to '...\SignedAssemblies\Splat.Drawing.dll'. Mono.Cecil.ResolutionException: Failed to resolve System.Reflection.BindingFlags
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.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
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 '...\SignedAssemblies\Splat.Drawing.dll' could not be found
@Chaoses-Ib
Copy link

Chaoses-Ib commented Jan 20, 2023

I have the same problem:

1>  Failed to write signed assembly to 'C:\...\obj\Debug\SignedAssemblies\Abc.Core.dll'. Mono.Cecil.ResolutionException: Failed to resolve Abc.Interop.Win32/MouseFlag
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 'C:\...\obj\Debug\SignedAssemblies\Abc.Core.dll' could not be found

And here is Abc.Interop.Win32.MouseFlag:

[Flags]
public enum MouseFlag : uint
{
    Move = 0x0001,
    LeftDown = 0x0002,
    LeftUp = 0x0004,
    RightDown = 0x0008,
    RightUp = 0x0010,
    MiddleDown = 0x0020,
    MiddleUp = 0x0040,
    XDown = 0x0080,
    XUp = 0x0100,
    VerticalWheel = 0x0800,
    HorizontalWheel = 0x1000,
    VirtualDesk = 0x4000,
    Absolute = 0x8000,
}

Do you have any workarounds for this?

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

No branches or pull requests

2 participants