70-536: Forwarding types?

19 11 2005

What the? Do you have any idea what they mean by forwarding types? I probably know it as a different name, or they are just trying to confuse me!


Actions

Information

9 responses to “70-536: Forwarding types?”

19 11 2005
Jason Haley (00:00:00) :

Doesn’t forwarding types have to do with InterOp?

19 11 2005
Mitch Denny (00:00:00) :

Hrm. Possibly, but I have always called that marshalling. There is nothing about forwarding types in the MSDN index - looks like we could have a translation problem somewhere :P

19 11 2005
Bill McCarthy (00:00:00) :

possibly the TypeForwardedTo attribute

19 11 2005
Mitch Denny (00:00:00) :

A little bit two obscure for this exam though ain’t it? Especially since they haven’t even really mentioned understanding assemblies as a pre-req.

7 12 2005
Vishal R Joshi (00:00:00) :

It was meant to be TypeForwardedToAttribute Class… The change request has been submitted… It should be updated on the web at http://www.microsoft.com/learning/exams/70-536.asp
within a few days…

Thanks for the feedback…

wishes

Vishal

10 01 2006
Squitherwizard (00:00:00) :

Type fowarding is simply a machanism to redirect the CLR’s type loader (at runtime) to look for the target type in another assembly.

It works like this.

Suppose you compile and ship an assembly (A1) containing type (T1)

A user of your assembly compiles and application (APP) which references A1.T1. They then deploy APP together with A1.

You now wish to refactor the assembly A1 and move T1 into a different assembly (e.g. you wish to split A1 into 2 new assemblies, A2 and A3).

This would force the user of your assembly to re-compile APP, since APP assunmes that T1 is in A1.

Imagine if class library vendors forced you to recompile your apps when they shipped updates !

With type forwarding you can avoid consumers of your assembly having to recompile.

It works like this

1. Code a new assembly (A2).

2. Move type T1 to from A1 to A2.

3. Remove T1 from A1.

4. Reference A2 from A1

5. Add a TypeForwardedTo attribute to A1, pointing at T1 (now in A2)

6. Recompile A1 and A2.

7. Replace the original A1 with the new A1 and A2 (in the locations used by APP)

Now when the CLR loads APP, it will look in A1 for T1 but find the type forward instead, causing it to look in A2 instead. Thus T1 has been moved to a new assembly while not breaking binary compatibility with APP.

Finally, if all this sounds familiar, it is, it’s just type forwarding in COM, the .Net way.

Just google ‘TreatAs’ and ‘COM’ to see what mean

markbillingham@blueyonder.co.uk

16 02 2006
Bill Bozeman (00:00:00) :

Mark, thanks for your explanation. I found it quite good and ended up using that to make some examples and test your theory out.

I posted the samples I did if anyone wants to try them out or test out their own.

http://www.bozemanblog.com/PermaLink,guid,2e6d7675-eb43-438f-8b93-9155ca1712fa.aspx

14 03 2006
14 06 2006
Omid (00:00:00) :

See MSDN2: Type Forwarding in the Common Language Runtime

http://msdn2.microsoft.com/en-us/library/ms404275(d=ide).aspx

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>