Error with monotouch.dialog (new monotouch update)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error with monotouch.dialog (new monotouch update)

Alejandro Vazquez
Hi,

I used to have the following code:

var root = new RootElement ("Tasks"){
            
            new Section ("Process Type")
                {
                    new RootElement ("Process", new RadioGroup ("processtype", 0)){
                        new Section (){
                            guarantor,dependent, volunteer, // all these are Elements
                    
                        }
                    }
                }       
            };



Now, I update Monotouch SDK, Xcode 5, etc... and when I try to build the project I get an error on the following line:

new RootElement ("Process", new RadioGroup ("processtype", 0)){

with the following error:

HumanResources/HumanPendingRequests.cs(18,18): Error CS0121: The call is ambiguous between the following methods or properties: `MonoTouch.Dialog.Section.Add(MonoTouch.Dialog.Element)' and `MonoTouch.Dialog.Section.Add(System.Collections.Generic.IEnumerable<MonoTouch.Dialog.Element>)' (CS0121)

Any clue on how to fix it and why is now showing that error?

Thanks a lot.

Alejandro




_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: Error with monotouch.dialog (new monotouch update)

Craig Dunn-2
an easy fix is to build up the Sections manually rather than combining it all into one statement, for example this old code:

Root = new RootElement ("Tasky") {
    new Section() {
        from t in tasks
        select (Element) new 
StringElement((t.Name==""?newTask:t.Name), t.Notes)
    }
};
  


INSTEAD becomes this -->


List<Element> le = new List<Element>();
foreach (var t in tasks) 
    le.Add (new StringElement((t.Name==""?
 newTask:t.Name), t.Notes));
// add to section
var s = new Section ();
s.AddAll (le);
// add as root
Root = new RootElement ("Tasky") { s }; 
  


Let us know if you have trouble converting your code - I think you'll need to flatten out both your Sections. It may not look as pretty but at least it is unambiguous.

This is not related to Xcode 5 or iOS 7 specifically, I think it is related to the changed covariance/contravariance handling of generic types in the latest version of Mono... (someone correct me if i'm wrong there).





On Tue, Sep 24, 2013 at 5:58 PM, Alejandro Vazquez <[hidden email]> wrote:
Hi,

I used to have the following code:

var root = new RootElement ("Tasks"){
            
            new Section ("Process Type")
                {
                    new RootElement ("Process", new RadioGroup ("processtype", 0)){
                        new Section (){
                            guarantor,dependent, volunteer, // all these are Elements
                    
                        }
                    }
                }       
            };



Now, I update Monotouch SDK, Xcode 5, etc... and when I try to build the project I get an error on the following line:

new RootElement ("Process", new RadioGroup ("processtype", 0)){

with the following error:

HumanResources/HumanPendingRequests.cs(18,18): Error CS0121: The call is ambiguous between the following methods or properties: `MonoTouch.Dialog.Section.Add(MonoTouch.Dialog.Element)' and `MonoTouch.Dialog.Section.Add(System.Collections.Generic.IEnumerable<MonoTouch.Dialog.Element>)' (CS0121)

Any clue on how to fix it and why is now showing that error?

Thanks a lot.

Alejandro




_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch



_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: Error with monotouch.dialog (new monotouch update)

Alejandro Vazquez
Thanks a lot Craig,

What I just did is:

var root = new RootElement ("Tasks"){
    new Section ("Process
 Type"){
        (MonoTouch.Dialog.Element)new RootElement ("Process", new RadioGroup ("processtype", 0)){
            new Section (){
                guarantor,dependent, volunteer // all these are Elements    
            }
        }
    }       
}; 

And it now compiles without errors.

Thanks a lot!

Alejandro


From: Craig Dunn <[hidden email]>
To: Alejandro Vazquez <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Tuesday, September 24, 2013 11:31 PM
Subject: Re: [MonoTouch] Error with monotouch.dialog (new monotouch update)

an easy fix is to build up the Sections manually rather than combining it all into one statement, for example this old code:

Root = new RootElement ("Tasky") {
    new Section() {
        from t in tasks
        select (Element) new 
StringElement((t.Name==""?newTask:t.Name), t.Notes)
    }
};
  


INSTEAD becomes this -->


List<Element> le = new List<Element>();
foreach (var t in tasks) 
    le.Add (new StringElement((t.Name==""?
 newTask:t.Name), t.Notes));
// add to section
var s = new Section ();
s.AddAll (le);
// add as root
Root = new RootElement ("Tasky") { s }; 
  


Let us know if you have trouble converting your code - I think you'll need to flatten out both your Sections. It may not look as pretty but at least it is unambiguous.

This is not related to Xcode 5 or iOS 7 specifically, I think it is related to the changed covariance/contravariance handling of generic types in the latest version of Mono... (someone correct me if i'm wrong there).





On Tue, Sep 24, 2013 at 5:58 PM, Alejandro Vazquez <[hidden email]> wrote:
Hi,

I used to have the following code:

var root = new RootElement ("Tasks"){
            
            new Section ("Process Type")
                {
                    new RootElement ("Process", new RadioGroup ("processtype", 0)){
                        new Section (){
                            guarantor,dependent, volunteer, // all these are Elements
                    
                        }
                    }
                }       
            };



Now, I update Monotouch SDK, Xcode 5, etc... and when I try to build the project I get an error on the following line:

new RootElement ("Process", new RadioGroup ("processtype", 0)){

with the following error:

HumanResources/HumanPendingRequests.cs(18,18): Error CS0121: The call is ambiguous between the following methods or properties: `MonoTouch.Dialog.Section.Add(MonoTouch.Dialog.Element)' and `MonoTouch.Dialog.Section.Add(System.Collections.Generic.IEnumerable<MonoTouch.Dialog.Element>)' (CS0121)

Any clue on how to fix it and why is now showing that error?

Thanks a lot.

Alejandro




_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch





_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: Error with monotouch.dialog (new monotouch update)

Craig Dunn-2
LOL yeah casting works too haha... in my defense, it was late when i typed that ;)


On Wed, Sep 25, 2013 at 5:02 AM, Alejandro Vazquez <[hidden email]> wrote:
Thanks a lot Craig,

What I just did is:

var root = new RootElement ("Tasks"){ new Section ("Process Type"){
(MonoTouch.Dialog.Element)new RootElement ("Process", new RadioGroup ("processtype", 0)){ new Section (){
guarantor,dependent, volunteer // all these are Elements } } } };

And it now compiles without errors.

Thanks a lot!

Alejandro


From: Craig Dunn <[hidden email]>
To: Alejandro Vazquez <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Tuesday, September 24, 2013 11:31 PM
Subject: Re: [MonoTouch] Error with monotouch.dialog (new monotouch update)

an easy fix is to build up the Sections manually rather than combining it all into one statement, for example this old code:

Root = new RootElement ("Tasky") {
    new Section() {
        from t in tasks
        select (Element) new 
StringElement((t.Name==""?newTask:t.Name), t.Notes)
    }
};
  


INSTEAD becomes this -->


List<Element> le = new List<Element>();
foreach (var t in tasks) 
    le.Add (new StringElement((t.Name==""?
 newTask:t.Name), t.Notes));
// add to section
var s = new Section ();
s.AddAll (le);
// add as root
Root = new RootElement ("Tasky") { s }; 
  


Let us know if you have trouble converting your code - I think you'll need to flatten out both your Sections. It may not look as pretty but at least it is unambiguous.

This is not related to Xcode 5 or iOS 7 specifically, I think it is related to the changed covariance/contravariance handling of generic types in the latest version of Mono... (someone correct me if i'm wrong there).





On Tue, Sep 24, 2013 at 5:58 PM, Alejandro Vazquez <[hidden email]> wrote:
Hi,

I used to have the following code:

var root = new RootElement ("Tasks"){
            
            new Section ("Process Type")
                {
                    new RootElement ("Process", new RadioGroup ("processtype", 0)){
                        new Section (){
                            guarantor,dependent, volunteer, // all these are Elements
                    
                        }
                    }
                }       
            };



Now, I update Monotouch SDK, Xcode 5, etc... and when I try to build the project I get an error on the following line:

new RootElement ("Process", new RadioGroup ("processtype", 0)){

with the following error:

HumanResources/HumanPendingRequests.cs(18,18): Error CS0121: The call is ambiguous between the following methods or properties: `MonoTouch.Dialog.Section.Add(MonoTouch.Dialog.Element)' and `MonoTouch.Dialog.Section.Add(System.Collections.Generic.IEnumerable<MonoTouch.Dialog.Element>)' (CS0121)

Any clue on how to fix it and why is now showing that error?

Thanks a lot.

Alejandro




_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch






_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch