Bug 5329 - System.Action and System.Func overrides needed in Portable Class Library profiles
Summary: System.Action and System.Func overrides needed in Portable Class Library prof...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-05-25 08:39 UTC by Stuart Lodge
Modified: 2014-03-07 09:57 UTC (History)
4 users (show)

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


Description Stuart Lodge 2012-05-25 08:39:40 UTC
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 UTC
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 UTC
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: 

  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 Mikayla Hutchinson [MSFT] 2012-09-04 11:21:25 UTC
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.