Hey Rasmus,

Thanks for taking the time to analyse the issue.

Could you provide me with a test case reproducing your issue, so that
I can debug that, confirm your behavior, and that we eventually share
the same root for the discussion/fix.

Thanks,

Jb

On 9/8/07, RasmusDK <[EMAIL PROTECTED]> wrote:
>
> Hi there
>
> While using Cecil I have come upon a problem, that I hope someone can
> help me with.
>
> Let me start with the code that provokes the problem:
> ----------------------------
> using SCG = System.Collections.Generic;
> ...
> class IntDoubleCache : SCG.Dictionary<int,double>
> { }                           //POINT 1
>
> class Foo
> {
>
>      void Bar()
>      {
>          ...
>          SCG.Dictionary<int,double> dic = new
> SCG.Dictionary<int,double>();   // POINT 2
>
> dic.ContainsKey(1);                                                           
>           //
> POINT 3
>          ...
>       }
> }
> ----------------------------
>
> Haveing the above code as an assembly, and an another assembly
> (target) in which I want to do some manipulation, I experience two
> scenarioes.
>
> Scenario 1) From POINT 2 and POINT 3, I import (mainModule.import) the
> MethodReference to the "constructor" and the "containsKey" methods of
> the SCG.Dictionary into the target assembly.
> When doing the first import the lookup at line 480 of ReflectionHelper
> returns null, and therefore a new TypeReference is build, and most
> importantly at line 496 generic parameters are added.
> Doing the second import the check at line 480 is succesful, and the
> later lookup in the "GetGenericParameter" method at line 458 is
> succesful.   So this is the nice scenario, everything works at it
> should.
>
>
> Scenario 2) Before importing the MethodReference from POINT 2 and 3, I
> first import the TypeReference of class IntDoubleCache. Now here comes
> the problem. When the baseClass (SCG.Dictionary) of IntDoubleCache is
> imported, there is not added any generic parameters at line 496. Later
> on when importing the MethodReference at POINT 3, the check at line
> 480 is succesful but the lookup at line 458 for the type of the
> genericParameter of this method fails as there are not any
> genericParameters in the TypeReference constructed earlier in the
> proces.
>
>
> So the question is, why scenario 2 does not work?
> I have tried to use some time in debugging mode, trying to figure out
> why Cecil does not include the generic parameters in the TypeReference
> in scenario 2, but I am not able to figure it out.
> So please, any help on how to get around this problem would be helpful
> (I can not just import the methodReferences before the TypeReference,
> this is not an option in my application).
>
> I know this question might not be the best written, but this is the
> best I can do. If more information is needed to clarify the problem,
> please let me know.
>
> regards,
> Rasmus
>
>
> >
>


-- 
Jb Evain  <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to