|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Generics and the Compact FrameworkHi, I'm writing an app that targets the Compact Framework on a particular device, and Cecil has been working brilliantly for me so far, but I've come across a weird problem to do with generics. The problem occurs when there's a class with generic parameters in the assembly I'm loading, for example: public class A<T> { } The assembly that Visual Studio creates loads fine on the device, but if I use Cecil to load it and save it, making no modifications, the device refuses to load it. Unfortunately I don't have an error message from the device for this, but I assume it thinks the assembly is invalid. Luckily, I've found a sort of workaround. If there's a generic class anywhere in the assembly that puts a constraint about the type of its generic parameter, e.g.: public class B { } public class C<T> where T : B { } Then I can run the assembly through Cecil and the device accepts it. Without class C, the assembly only works if there are no generic types at all, but with class C present, I can have as many generic types as I want. Can you think of anything that might cause this behaviour? I'm using Cecil 0.6 stable. Do you think it's worth trying this out on the latest unstable build? By the way, I've tested assemblies made from the same source code on my PC and they work fine with or without class C, so it seems to be a quirk in the Compact Framework implementation. Thanks, Henry --~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact Frameworkhttp://msdn.microsoft.com/en-us/library/d5x73970.aspx public class A<T> where T : class if you don't want to have a concrete B class. On Aug 16, 12:54 pm, kernelpanic99 <falcone...@...> wrote: > Hi, > I'm writing an app that targets the Compact Framework on a particular > device, and Cecil has been working brilliantly for me so far, but I've > come across a weird problem to do with generics. > > The problem occurs when there's a class with generic parameters in the > assembly I'm loading, for example: > > public class A<T> > { > > } > > The assembly that Visual Studio creates loads fine on the device, but > if I use Cecil to load it and save it, making no modifications, the > device refuses to load it. Unfortunately I don't have an error message > from the device for this, but I assume it thinks the assembly is > invalid. > > Luckily, I've found a sort of workaround. If there's a generic class > anywhere in the assembly that puts a constraint about the type of its > generic parameter, e.g.: > > public class B > { > > } > > public class C<T> where T : B > { > > } > > Then I can run the assembly through Cecil and the device accepts it. > Without class C, the assembly only works if there are no generic types > at all, but with class C present, I can have as many generic types as > I want. Can you think of anything that might cause this behaviour? I'm > using Cecil 0.6 stable. Do you think it's worth trying this out on the > latest unstable build? > > By the way, I've tested assemblies made from the same source code on > my PC and they work fine with or without class C, so it seems to be a > quirk in the Compact Framework implementation. > > Thanks, > Henry -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkThanks for the suggestion, but I tried that and the device still won't load the assembly. It only works with the setup I explained above. I think the problem must be in the serialization of the assembly when it's saved, and I was just wondering if anyone knew why having a generic class with a constraint would make a difference to that. I'm willing to fix it myself if someone could point me in the right direction. Thanks, Henry On Aug 17, 6:25 am, leblancmeneses <leblancmene...@...> wrote: > http://msdn.microsoft.com/en-us/library/d5x73970.aspx > > public class A<T> where T : class > > if you don't want to have a concrete B class. > > On Aug 16, 12:54 pm, kernelpanic99 <falcone...@...> wrote: > > > > > Hi, > > I'm writing an app that targets the Compact Framework on a particular > > device, and Cecil has been working brilliantly for me so far, but I've > > come across a weird problem to do with generics. > > > The problem occurs when there's a class with generic parameters in the > > assembly I'm loading, for example: > > > public class A<T> > > { > > > } > > > The assembly that Visual Studio creates loads fine on the device, but > > if I use Cecil to load it and save it, making no modifications, the > > device refuses to load it. Unfortunately I don't have an error message > > from the device for this, but I assume it thinks the assembly is > > invalid. > > > Luckily, I've found a sort of workaround. If there's a generic class > > anywhere in the assembly that puts a constraint about the type of its > > generic parameter, e.g.: > > > public class B > > { > > > } > > > public class C<T> where T : B > > { > > > } > > > Then I can run the assembly through Cecil and the device accepts it. > > Without class C, the assembly only works if there are no generic types > > at all, but with class C present, I can have as many generic types as > > I want. Can you think of anything that might cause this behaviour? I'm > > using Cecil 0.6 stable. Do you think it's worth trying this out on the > > latest unstable build? > > > By the way, I've tested assemblies made from the same source code on > > my PC and they work fine with or without class C, so it seems to be a > > quirk in the Compact Framework implementation. > > > Thanks, > > Henry -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkHey, On 8/16/09, kernelpanic99 <falconer21@...> wrote: > I'm > using Cecil 0.6 stable. Do you think it's worth trying this out on the > latest unstable build? Cecil 0.6 is by no mean stable. Use the latest daily drop. -- Jb Evain <jb@...> --~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkFor 'latest daily drop', is this the correct SVN URL: svn://anonsvn.mono-project.com/source/trunk/mcs/class/Mono.Cecil Also, is this the same as 'SVN head' that everybody keeps mentioning? Sorry, but I am not that familiar with SVN terminology. On Aug 17, 2:25 pm, Jb Evain <j...@...> wrote: > Hey, > > On 8/16/09, kernelpanic99 <falcone...@...> wrote: > > > I'm > > using Cecil 0.6 stable. Do you think it's worth trying this out on the > > latest unstable build? > > Cecil 0.6 is by no mean stable. Use the latest daily drop. > > -- > Jb Evain <j...@...> -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkNope, this one
Easier than checking out the svn
Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Mon, Aug 17, 2009 at 3:02 PM, JohnC <john.crowe6@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkBut it can be a pain to download whole package each day. Can you tell me the SVN equivalent of the daily drop? On Aug 17, 5:28 pm, Tuna Toksoz <tehl...@...> wrote: > Nope, this onehttp://mono.ximian.com/daily/ > > <http://mono.ximian.com/daily/>Easier than checking out the svn > > Tuna Toksöz > Eternal sunshine of the open source mind. > > http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike > > On Mon, Aug 17, 2009 at 3:02 PM, JohnC <john.cro...@...> wrote: > > > For 'latest daily drop', is this the correct SVN URL: > > svn://anonsvn.mono-project.com/source/trunk/mcs/class/Mono.Cecil > > > Also, is this the same as 'SVN head' that everybody keeps mentioning? > > > Sorry, but I am not that familiar with SVN terminology. > > > On Aug 17, 2:25 pm, Jb Evain <j...@...> wrote: > > > Hey, > > > > On 8/16/09, kernelpanic99 <falcone...@...> wrote: > > > > > I'm > > > > using Cecil 0.6 stable. Do you think it's worth trying this out on the > > > > latest unstable build? > > > > Cecil 0.6 is by no mean stable. Use the latest daily drop. > > > > -- > > > Jb Evain <j...@...> > > -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkTuna, you are wrong. As far as Cecil is concerned, the one at svn://anonsvn.mono-project.com/source/trunk/mcs/class/Mono.Cecil is more current than the one in Mono daily build. I checked both and the Changelog for the svn has latest entries than the daily build. Can somebody confirm this and also if this is what you mean by 'SVN head'? On Aug 17, 7:13 pm, JohnC <john.cro...@...> wrote: > But it can be a pain to download whole package each day. Can you tell > me the SVN equivalent of the daily drop? > > On Aug 17, 5:28 pm, Tuna Toksoz <tehl...@...> wrote: > > > Nope, this onehttp://mono.ximian.com/daily/ > > > <http://mono.ximian.com/daily/>Easier than checking out the svn > > > Tuna Toksöz > > Eternal sunshine of the open source mind. > > >http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt... > > > On Mon, Aug 17, 2009 at 3:02 PM, JohnC <john.cro...@...> wrote: > > > > For 'latest daily drop', is this the correct SVN URL: > > > svn://anonsvn.mono-project.com/source/trunk/mcs/class/Mono.Cecil > > > > Also, is this the same as 'SVN head' that everybody keeps mentioning? > > > > Sorry, but I am not that familiar with SVN terminology. > > > > On Aug 17, 2:25 pm, Jb Evain <j...@...> wrote: > > > > Hey, > > > > > On 8/16/09, kernelpanic99 <falcone...@...> wrote: > > > > > > I'm > > > > > using Cecil 0.6 stable. Do you think it's worth trying this out on the > > > > > latest unstable build? > > > > > Cecil 0.6 is by no mean stable. Use the latest daily drop. > > > > > -- > > > > Jb Evain <j...@...> > > -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkOn 8/17/09, JohnC <john.crowe6@...> wrote: > Tuna, you are wrong. As a matter of fact, he's right. > As far as Cecil is concerned, the one at > > svn://anonsvn.mono-project.com/source/trunk/mcs/class/Mono.Cecil > > is more current than the one in Mono daily build. I checked both and > the Changelog for the svn has latest entries than the daily build. This is the svn, so of course the source here is up to date. The downside is that you have to do a svn checkout, and build it yourself. Hence my suggestion to download a daily drop, prebuilt, binary of cecil. > Can somebody confirm this and also if this is what you mean by 'SVN > head'? HEAD just means the last revision in svn. -- Jb Evain <jb@...> --~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkThanks for clarifying! On Aug 17, 9:21 pm, Jb Evain <j...@...> wrote: > On 8/17/09, JohnC <john.cro...@...> wrote: > > > Tuna, you are wrong. > > As a matter of fact, he's right. > > > As far as Cecil is concerned, the one at > > > svn://anonsvn.mono-project.com/source/trunk/mcs/class/Mono.Cecil > > > is more current than the one in Mono daily build. I checked both and > > the Changelog for the svn has latest entries than the daily build. > > This is the svn, so of course the source here is up to date. The > downside is that you have to do a svn checkout, and build it yourself. > Hence my suggestion to download a daily drop, prebuilt, binary of > cecil. > > > Can somebody confirm this and also if this is what you mean by 'SVN > > head'? > > HEAD just means the last revision in svn. > > -- > Jb Evain <j...@...> -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkHey, I just got the latest daily drop and the problem has gone away! Sorry I didn't try that before posting. By the way, Jb, thanks for starting and continuing to work on such a great project. From the work I've done on my own app, I've developed a few little utility methods that could be used for any Cecil project, such as a method for working out if one method overrides another (harder than it sounds!), and I'd be more than happy to contribute them to Cecil if you think they'd be useful. Thanks again, Henry On Aug 17, 10:25 am, Jb Evain <j...@...> wrote: > Hey, > > On 8/16/09, kernelpanic99 <falcone...@...> wrote: > > > I'm > > using Cecil 0.6 stable. Do you think it's worth trying this out on the > > latest unstable build? > > Cecil 0.6 is by no mean stable. Use the latest daily drop. > > -- > Jb Evain <j...@...> -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Generics and the Compact FrameworkThank you Jb,
I had somehow the same problem and now solved using latest version. regards, KC On Mon, Aug 17, 2009 at 12:55 PM, Jb Evain <jb@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |