Put 2 cups of the milk in a bowl and grate the chocolate into it. Place this over hot water to melt the chocolate. In another bowl, blend the sugar, cornstarch, flour, and salt together with the remaining ½ cup of milk. When the chocolate melts completely, add the egg yolks (beaten), stirring constantly. Add the sugar and flour mixture to it. Cook this over boiling water and stir constantly, until it thickens. Add the vanilla, and let it cool. Pour it into the pastry shell.