dahomey-technologies/Dahomey.Cbor

System.ArgumentException: method return type is incompatible

Closed this issue · 4 comments

System.ArgumentException: method return type is incompatible
in: EnumConverter.cs:12
private static readonly Func<int, T> intToEnum = (Func<int, T>)Delegate.CreateDelegate(typeof(Func<int, T>), null, intIdentity.Method);

Could give me more details about the problem?
When does ot happen?
Do you have a complete callstack?
Which object are serializing/deserializing?

What is your .net runtime?
.net core? .net framework ? Which version?

Hi! Yeah I'm trying to make a test to reproduce it but then I ran into another issue. Will continue tomorrow.

I tried to create a test (will commit) but it doesn't happen on .NET Core. It has to do with the Xamarin.iOS code:
/Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/mcs/class/corlib/System/Delegate.cs

At row: 191 (file attached)
Delegate.zip

But maybe you can see something that you can do differently so it works better. I have no clue what is the issue here.

Type that goes in:
{System.Func2[System.Int32,System.Net.HttpStatusCode]} "System.Func2[[System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Net.HttpStatusCode, System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"

Debug info:

=== Visual Studio Community 2019 for Mac ===

Version 8.2.6 (build 26)
Installation UUID: 8a28987a-1e72-4b4e-ae4d-21612ffbdc71
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.14.0.85 (d16-2-fix-mac-updates / 86973979)

Package version: 600000334

=== Mono Framework MDK ===

Runtime:
Mono 6.0.0.334 (2019-02/6256b82d62f) (64-bit)
Package version: 600000334

=== NuGet ===

Version: 5.1.0.6013

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.2.7
2.1.12
2.1.11
2.1.9
2.1.8
2.1.2
2.0.5
2.0.0
1.1.2
1.0.5
SDK: /usr/local/share/dotnet/sdk/2.2.402/Sdks
SDK Versions:
2.2.402
2.1.701
2.1.700
2.1.505
2.1.504
2.1.302
2.1.4
2.0.0
1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/msbuild/Current/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.10
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 9.4.1.0 (Visual Studio Community)
Commit: xamarin-android/d16-2/ebd65c9
Android SDK: /Users/developer/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.1
SDK Build Tools Version: 27.0.2

Build Information:
Mono: mono/mono@e6f5369c2d2
Java.Interop: xamarin/java.interop/d16-2@d64ada5
LibZipSharp: grendello/LibZipSharp/d16-2@caa0c74
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-2@6f6c969

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/developer/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android Device Manager ===

Version: 1.2.0.60
Hash: 686c817
Branch: remotes/origin/d16-2
Build date: 2019-08-07 15:49:58 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Xamarin Designer ===

Version: 16.2.0.379
Hash: 3f0652957
Branch: remotes/origin/d16-2
Build date: 2019-08-01 17:32:50 UTC

=== Apple Developer Tools ===

Xcode 10.3 (14492.2)
Build 10G8

=== Xamarin.Mac ===

Version: 5.14.0.114 (Visual Studio Community)
Hash: c6691164
Branch: d16-2
Build date: 2019-07-29 15:54:06-0400

=== Xamarin.iOS ===

Version: 12.14.0.114 (Visual Studio Community)
Hash: c6691164
Branch: d16-2
Build date: 2019-07-29 15:54:05-0400

=== Build Information ===

Release ID: 802060026
Git revision: a4ea4d00345f4d98a95bd2322b1d04935eb553e1
Build date: 2019-09-05 18:24:25+00
Build branch: release-8.2
Xamarin extensions: 366997b587d63360705507e281ae75025762cadf

=== Operating System ===

Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
Tue Aug 20 16:57:14 PDT 2019
root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

DeepClean 1.2.5
LiveXAML 1.3.51
Stack Overflow Search 0.7.1
FileNesting 0.1.2
XAML Styler 1.1.4