Bug 48146 - Operator (-) used in F# raises Specified method is not supported exception from C#.
Summary: Operator (-) used in F# raises Specified method is not supported exception fr...
Status: CONFIRMED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-28 00:28 UTC by Mateusz Lewko
Modified: 2018-01-18 22:44 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Archive contains two projects ProjA (c#) and ProjB (f#) that show this bug. (20.54 KB, application/zip)
2016-11-28 00:28 UTC, Mateusz Lewko
Details

Description Mateusz Lewko 2016-11-28 00:28:23 UTC
Created attachment 18683 [details]
Archive contains two projects ProjA (c#) and ProjB (f#) that show this bug.

I have this generic function in F# thats uses (-) operator:

let inline sub a b = a - b


No I'm calling this function from C#:

int a = sub<int, int, int>(4, 1);

This raises an error:
Unhandled Exception:
System.NotSupportedException: Specified method is not supported.
  at ProjA.MainClass.Main (System.String[] args) [0x00000] in <4f209fa43741462db3b8f73ac83c35a2>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NotSupportedException: Specified method is not supported.
  at ProjA.MainClass.Main (System.String[] args) [0x00000] in <4f209fa43741462db3b8f73ac83c35a2>:0

Please not that this works fine for (+) operator or without inline keyword. 

I'm attaching simple projects with this code so you can see the bug by yourself.
Comment 1 Ludovic Henry 2018-01-18 22:44:44 UTC
I can reproduce with Mono 5.11.0.276 (master/117468d740a).

The steps are as follow:

 - msbuild ProjA
 - msbuild ProjB
 - cp ProjB/ProjB/obj/x86/Debug/ProjB.exe ProjA/ProjA/bin/Debug/
 - cp ProjB/ProjB/obj/x86/Debug/FSharp.Core.dll ProjA/ProjA/bin/Debug/
 - cd ProjA/ProjA/bin/Debug && mono ProjA.exe

Note You need to log in before you can comment on or make changes to this bug.