This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 5329 - System.Action and System.Func overrides needed in Portable Class Library profiles
: System.Action and System.Func overrides needed in Portable Class Library prof...
Status: RESOLVED FIXED
Product: Class Libraries
Classification: Mono
Component: System
: unspecified
: All All
: --- normal
: ---
Assigned To: Bugzilla
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-05-25 08:39 EDT by Stuart Lodge
Modified: 2014-03-07 09:57 EST (History)
4 users (show)

See Also:
Tags:
Test Case URL:
External Submit: ---


Attachments

Description Stuart Lodge 2012-05-25 08:39:40 EDT
I'm currently continuing to try to build "portable class libraries" or
"portable library projects" for cross platform development.

When I try to create any class library which uses System.Func or System.Action,
then MonoDevelop always complains about the delegate requiring between one <T1>
and ten <T1, ... T10> type arguments.

For example:
- use MonoDevelop 3.0.2
- create a new portable library project
- in the generated myClass.cs file, use constructor
public MyClass
{
    System.Func<bool> func;
    System.Action act;
}

- hit compile and the error messages are along the lines of "Using the generic
type 'System.Func<T1, T2,...., T9, TResult>' requires '10' type argument(s)
(CS0305)
Comment 1 Stuart Lodge 2012-05-29 12:21:04 EDT
If it helps at all when you look at this bug, then I've seen similar issues
when coding the portable libraries and MonoTouch projects within VS2010 using
VSMonoTouch.

These have generally been resolved by tweaking the way the project links to
mscorlib using instructions from
http://slodge.blogspot.co.uk/2012/05/if-you-install-visual-studio-11-and.html

But not sure that will help...
Comment 2 Matthew Leibowitz 2012-09-04 04:07:11 EDT
When building the PCL, these diferences occur:

  mscorlib resolves to /Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll
  but is built with
/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/2.0/mscorlib.dll

As in the comments: 
https://bugzilla.xamarin.com/show_bug.cgi?id=5346#c3

  Current stable mcs can only build against the mscorlib that it's running on.
  This makes it ~impossible to build against arbitrary frameworks such as PCL.

The MonoTouch mscorlib has the Action and Func<T>, but the Mono framework does
not.

The end part of that comment is:

  To fix this, you'll need to update to Mono 2.12, which is currently in alpha.
Comment 3 Michael Hutchinson 2012-09-04 11:21:25 EDT
You're probably running into bug 6649.

You can find a workaround here:
http://stackoverflow.com/questions/12041290/monodevelop-is-it-possible-to-switch-pcls-compiler/12062589#12062589

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