<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

Post Categories

Navigation

Subscriptions

The SLAR (vol2) on System.Reflection.AmbiguousMatchException

Continuing in the series sharing some of the information in the .NET Framework Standard Library Annotated Reference Vol 1 and .NET Framework Standard Library Annotated Reference Vol 2 with some information on AmbiguousMatchException.

 

public sealed class AmbiguousMatchException : SystemException

{

// Constructors

public AmbiguousMatchException();

public AmbiguousMatchException(string message);

public AmbiguousMatchException(string message, Exception inner);

}

 

Joel Pobar

This exception is commonly thrown when input parameters to various non–plural XXXInfo/

Type methods (Type.GetMethod/GetField, etc.) result in multiple matches from the binder.

When calling these non–plural methods, it’s best to be specific in your BindingFlags and

always add type parameters for the methods that can accept them.

I’ve also seen this exception break deployed code where the code reflects on a library (loaded

by name) that is versioned out of band. To illustrate this, a brief example:

MyLibrary.dll (Version 1.0)

class Foo

{

   public void MyExtensibilityPoint() {}

}

 

MyLibrary.dll (Version 2.0)

class Foo

{

   public void MyExtensibilityPoint() {}

   public void MyExtensibilityPoint(int a) {}

}

 

My Deployed Code:

MethodInfo m = typeof(Foo).GetMethod("MyExtensibilityPoint");

Version 2 of the MyLibrary dll is deployed with a new overload of MyExensibilityPoint

to type Foo. Rerunning “My Deployed Code” above on Version 2 of the type results in an

ambiguous match exception because we now have two methods with the same name, and

we’re not specifying the parameters of the method for binding. To avoid this scenario, always

use the GetXXX APIs and supply as many specifics as possible (in this case, supplying a type

array specifying the methods parameters), and consider including the version part when

loading the assembly/library.

 

posted Wednesday, September 28, 2005 9:02 PM by admin with 0 Comments

What's the differnece between CIL and MSIL?

I was recently asked what the difference between CIL and MSIL is…   the short answer is not much.  They both describe the underlying CPU-independent instruction set the CLR executes after a high level language (C#, VB, C++, Python, Ruby, Pascal, etc) has compiled your source code.  The difference between them is the exact version you are referring to.

 

CIL -  Common Intermediate Language  - is the term used in the International Standard.  

MSIL -  Microsoft Intermediate Language   - is the product term for the Microsoft implementation of that standard.

 

Clear as mud?

posted Tuesday, September 20, 2005 7:45 PM by admin with 0 Comments

WinForms PDC follow-up

Jessica did a great post listing the frequently asked questions she received while at the PDC this year… I only hope more teams do the same thing.  This is an excellent resource!  

 

http://blogs.msdn.com/jfoscoding/archive/2005/09/19/471492.aspx

 

posted Tuesday, September 20, 2005 4:27 AM by admin with 0 Comments

A great Sparkle blog...

FYI – one of the designers on Expression Interactive Designer “Sparkle” just started a blog… http://spaces.msn.com/members/manodesign/

 

Should be a good read..

posted Monday, September 19, 2005 3:35 AM by admin with 0 Comments

PDC: Download slides for the breakout sessions

Folks at the PDC can download slides from breakouts by going to… you guessed it CommNet… Here is the particular URL:

http://commnet1.microsoftpdc.com/content/downloads.aspx

It typically takes 24 hours or so from the time the session is given until they are posted.

posted Thursday, September 15, 2005 10:19 PM by admin with 0 Comments

PDC2005 WinFX Namespace Poster

The MSDN folks keep giving this morning… They just posted a highres version of the namespace poster we gave out here at the PDC.  Enjoy!

 

I’d still love to hear you feedback

 

posted Thursday, September 15, 2005 5:23 PM by admin with 0 Comments

Download the WinFX September CTP...

You will love this drop of WinFX… it has the Windows Workflow Services stuff in there as well as Windows Presentation Foundation (“Avalon”) and Windows Communication Foundation (“Indigo”)…

 

Just a note – it does work only with the BETA2 build of .NET Framework 2.0 and VS 2005… So don’t try to make this work on top of anything more recent.

 

http://msdn.microsoft.com/winfx/getthebeta/default.aspx

 

Have Fun!

posted Wednesday, September 14, 2005 8:38 PM by admin with 0 Comments

Our first look at the Framework Design Guidelines book...
Here is a very cheese picture of Krys and I as we see for the first time real copies of the Framework Design Guidelines book at the PDC book store…

posted Wednesday, September 14, 2005 1:33 AM by admin with 0 Comments

PreCon: Designing Reusable Class Libraries

Krys and I had a great time at our precon yesterday…   It was especially fun to give away copies of the Framework Design Guidelines book.  Krys and I (and the great folks at AW) worked double time to get the book ready for the PDC.  It was an amazing high for us to get to hold the first copy of the book at the PDC where we give out 300+ copies at our day long percon.  

 

I am told the full set of slides are available now on Commnet for those here at the PDC… I will try to get them posted for everyone else in the world next week.  

 

The feedback we got from the precon so far as been great…   Here a couple of the post I saw… I am sure I missed some, please send me a link and I will blog it.

http://spaces.msn.com/members/keithhill/Blog/cns!1pXfg3ewg2388QePf3S4h7YA!142.entry

http://seewinapp.blogspot.com/2005/09/pdc-precon-monday-pit-of-success.html

http://seewinapp.blogspot.com/2005/09/pdc-precon-monday-framework-design.html

Also, if you have not already, please do fill out the online eval form…

 

At the very end of the day, Krys showed solution to the group exercise we did… I thought I’d include it here for your reference.

 

Scenarios

 

Send Text Message

EmailMessage message = new EmailMessage(“kcwalina@microsoft.net”,”brada@microsoft.net”);

message.Body = “Welcome to the PDC!”;

message.Cc.Add(“kcwalina@mmm”);

message.Send();

 

Send message with attachement

EmailMessage message = new EmailMessage(“kcwalina@microsoft.net”,”brada@microsoft.net”);

message.Body = “Welcome to the PDC!”;

message.Attachements.Add(“picture.jpeg”);

message.Send();

 

API Design

 

public class EmailMessage {

     public EmailMessage(string from, params string[] to);

    

     public string From { get; set; }

     public Collection<string> To { get; }

     public Collection<string> Cc { get; }

     public Collection<string> Bcc { get; }

     public string Body { get; set; }

     public Collection<string> Attachments { get; }

     public void Send();

}

 

posted Tuesday, September 13, 2005 7:28 PM by admin with 0 Comments

And now the phone on your desk can run .NET too...

Check out the new release from Verizon… https://www22.verizon.com/verizon-one/tour/

Verizon One is a “super” featured desktop phone that runs the .NET Compact Framework… I wonder if they let you develop for the thing?  It would be cool to write a RSS reader for the thing ;-)

 

Let me know if you get one, I’d love to hear how you like it…

posted Friday, September 09, 2005 2:07 AM by admin with 0 Comments

The SLAR (vol2) on System.Net.Sockets.AddressFamily

Looks like the SLAR vol2 finally made its way to book sealer’s warehouses which means everyone that pre-ordered should be getting their copy soon.  I’d love to hear what you think and I’d encourage you to help your fellow developers by posting a review on Amazon and\or on your blog. 

 

In honor of this day, I thought I’d restart the series sharing some of the information in the .NET Framework Standard Library Annotated Reference Vol 1 and .NET Framework Standard Library Annotated Reference Vol 2 with some information on AddressFamily (the first type in Vol2)

 

public enum AddressFamily

{

AppleTalk = 16,

Atm = 22,

Banyan = 21,

Ccitt = 10,

Chaos = 5,

Cluster = 24,

DataKit = 9,

DataLink = 13,

DecNet = 12,

Ecma = 8,

FireFox = 19,

HyperChannel = 15,

Ieee12844 = 25,

ImpLink = 3,

InterNetwork = 2,

InterNetworkV6 = 23,

Ipx = 6,

Irda = 26,

Iso = 7,

Lat = 14,

MS Max = 29,

NetBios = 17,

NetworkDesigners = 28,

NS = 6,

Osi = 7,

Pup = 4,

Sna = 11,

Unix = 1,

Unknown = -1,

Unspecified = 0,

VoiceView = 18,

}

 

Lance Olson

This list was derived mainly from the winsock header files. While the socket classes included in

v1 of the .NET Framework are mostly geared around IP-based communication, it is possible to

use the EndPoint class to support other protocols such as IPX, AppleTalk, Infra Red, and so

forth.

 

 

using System;

using System.Net;

using System.Net.Sockets;

using System.Text;

public class AddressFamilySample

{

   public static void Main()

   {

     IPAddress ip = IPAddress.Parse("127.0.0.1");

     Socket skt = new Socket(AddressFamily.InterNetwork,

     SocketType.Dgram, ProtocolType.Udp);

     try

     {

        IPEndPoint ep = new IPEndPoint(ip, 9999);

        skt.Connect(ep);

        byte[] req = Encoding.ASCII.GetBytes("Test");

        skt.SendTo(req, ep);

        IPEndPoint rep = (IPEndPoint)skt.LocalEndPoint;

        Console.WriteLine("LocalEndPoint details:");

        Console.WriteLine("Address: {0}", rep.Address);

        Console.WriteLine("AddressFamily: {0}", rep.AddressFamily);

        Console.WriteLine("Port: {0}", rep.Port);

     }

     catch (Exception e)

     {

        Console.WriteLine("Error: " + e.Message);

     }

     finally

     {

        skt.Close();

     }

     Console.WriteLine();

     Console.WriteLine();

     Console.WriteLine("Press Enter to continue");

     Console.ReadLine();

   }

}

 

The output is

LocalEndPoint details:

Address: 127.0.0.1

AddressFamily: InterNetwork

Port: 4082

Press Enter to continue

 

posted Monday, September 05, 2005 8:47 PM by admin with 0 Comments

PDC Prep: Talk on how to give a talk

As we are in full-swing in talk preparation for the PDC, I thought I’d reference a great talk on, well, how to give a talk..   Simon Peyton Jones is a senior researcher at Microsoft Research and he gave this talk a few years ago, but it is equally valuable today as it was a few years ago when he presented it and spookily applicable to the PDC as it is to the research community.  

 

For those of you going to the PDC, I encourage you to fill out the surveys after each talk and let us know what you really think – that is the only way we will get better.. In fact feel free to reference this talk in your comments if you think the speaker should watch it before the next PDC ;-) 

For the PDC speakers that happen to read my blog – watch this talk, I guarantee it will raise your speaker scores!  

 

One of the best speakers I know of told me he watches *this talk* every time before he gives a talk.. that should be testimony enough.. but if not, here are a few of my notes from watching it…

 

-          Want to make the foam to find out more about your topic…

-          Your mission is to WAKE them up!!

-          First two minutes are the key…  you gotta give them a reason to not disconnect?

-          Broad but shallow is boring!  

-          Examples are more important than the general case…

-          If you seem to be enthusiastic about your idea, your audience opens up to  it… “at least it is important to somebody”

-          Write your slides the night before… or at least do something to make it fresh in your mind..

-          Parkinson’s law – Super valuable law!

-          Don’t apologize!

-          Memorize the first 3 sentences by heart to get you off an running..

-          Remember to go to the bathroom ;-)

-          You must finish on time….

 

Folks that are veterans of PDC past – what is your pet peeve about PDC talks?  What do you want to see speakers do differently?  What did you LOVE seeing in the past?

posted Friday, September 02, 2005 4:53 AM by admin with 0 Comments

PDC Panel: Looking Ahead to the Future of the CLR

I am super excited to get the opportunity to moderate the Looking Ahead to the Future of the CLR panel at the PDC..   While the panelist and I have some great ideas of what we could talk about, I’d love to hear your thoughts.  Where do you want to go with panel? What are you hoping to hear about?   

posted Monday, August 29, 2005 11:59 AM by admin with 0 Comments

Sample Chapter from the SLARv2 posted

DevX.com recently posted a sample chapter of .NET Framework Standard Library Annotated Reference, Volume 2 

They choose System.Xml.XmlReader… some good annotations on this one.

 

I’d love to hear your comments on this sneak peak…

posted Thursday, August 25, 2005 12:01 PM by admin with 0 Comments

My PDC interview on Channel9

The channel9 guys just posted an interview we did focusing on the PDC.  Check it out  Love to hear your comments..  Anything you didn't know before?  BTW, I don't think it is too late to register for the PreCon if you are already comming to the PDC, you might as well come a little early. 

 

 

posted Wednesday, August 24, 2005 4:04 PM by admin with 0 Comments

Powered by Community Server, by Telligent Systems