An ice-cream sandwich consists of two cookies, often made with chocolate or other flavoring, with ice cream in between them. Of course, cookies require the Beracha of "Mezonot" whereas over ice cream one recites the Beracha of "She’hakol." The question thus arises, which Beracha does one recite over an ice cream sandwich: "Mezonot," "She’hakol," or perhaps both – "Mezonot" over the cookie and "She’hakol" over the ice cream?
The Shulhan Aruch (Orah Haim 212:2) rules that if a person eats a cracker with jelly spread on it, he recites only the Beracha of "She’hakol." In such a case, the person’s primary intent is to eat the jelly, and the cracker serves mainly to hold the jelly, which cannot be neatly held directly in one’s hand. Since the primary intent is to eat the jelly, it is considered the main food, and thus one recites a Beracha over the jelly, and this Beracha covers the cracker, as well.
At first glance, this rationale should apply to an ice cream sandwich, as well. The main intent is to eat the ice cream, and the cookies serve primarily to provide a relatively neat and an efficient way of eating the ice cream. As such, we might think, one should recite only the Beracha of "She’hakol."
However, the Magen Abraham (Rav Abraham Gombiner, Poland, 1637-1682) writes that the Shulhan Aruch’s ruling applies only when one eats jelly on an unflavored cracker or wafer. In such a case, it is clear that the person’s primary intent is to eat the jelly. But if the cracker has a flavor and is tasty in its own right, then it is regarded as the primary food, and one would thus recite "Mezonot" which would cover both the cracker and the jelly. Clearly, the cookie portion of an ice cream sandwich is tasty and flavorful, and, as mentioned, it often contains chocolate and sweetening agents. Hence, the cookie is considered the primary food, and one should therefore recite the Beracha of "Mezonot," which covers both the cookie and the ice cream.
The Hafetz Haim (Rav Yisrael Meir Kagan of Radin, 1839-1933), however, in his Mishna Berura (168:45), writes that this entire discussion applies only if the two foods were baked together. In such a case, one recites a Beracha on the primary food, which also covers the subordinate food. If, however, the spread was placed on the cracker after it was baked, then we treat the two foods as separate entities, such that each requires a separate Beracha. Quite obviously, the cookie and ice cream of an ice cream sandwich are not baked together, and thus according to the Mishna Berura, one would be required to recite two separate Berachot – "Mezonot" over the cookie, and "She’hakol" over the ice cream.
However, Hacham Ovadia Yosef, in his Yabia Omer (vol. 8), disputes the Mishna Berura’s ruling, and maintains that even if the two foods were not baked together, one recites only a Beracha over the primary food. And thus in the case of an ice cream sandwich, one recites only "Mezonot," and this Beracha covers both the cookie and ice cream. This Halacha is discussed in Yalkut Yosef – Berachot, vol. 3 (p. 280, in the footnote).
Summary: Before eating an ice cream sandwich, one recites "Mezonot" and this Beracha covers both the cookie and ice cream.