title: Does CanvasDrawingSession.DrawSvg() work in C++/winrt?
body: <p>I've loaded a series of svg images by creating and storing a CanvasSvgDocument for each, and using its LoadAsync() method to load the svg:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>nextSvg = CanvasSvgDocument(resourceCreator.Device());
  auto fileStream = co_await nextFile.OpenReadAsync();
  co_await nextSvg.LoadAsync(resourceCreator.Device(),fileStream);
  </code></pre>
  
  <p>This appears to load the svg, but when I use that stored svg in a drawing session nothing appears in the CanvasControl. Other items draw fine: shapes, lines, etc. - just not svgs:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>session.DrawSvg(m_svg, boxSize, top, left);
  </code></pre>
  
  <p>In an attempt to discover the problem I've tried using GetXml() on the svg document in the hope that would show me its contents. The result is an abbreviated svg with no drawing information. I provide that here in case it's a hint:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt;&lt;/svg&gt;
  </code></pre>
  
  <p>Perhaps that is all that GetXml() is supposed to return? 
  I have successfully drawn svgs if they loaded as imagesources; the resulting bitmap image works. But is it possible that session.DrawSvg() is just not completely implemented yet in Win2D? I'd rather render the svg directly this way if it can be done.</p>
  
  <p>[Update] p.s. The svgs are version 1.1 svgs converted from pdfs by one of the online conversion services. As I mentioned, they render fine if opened in Edge or other browsers.</p>
  
  <p>[Update2] Thinking perhaps there is something in the svgs that Win2D doesn't like, I tried creating a simple one using as a model an online example - it just has a rectangle and a circle, as follows. But it also does not draw:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;  
  &lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 140" 
       preserveAspectRatio="xMidYMid meet"&gt;
    &lt;title&gt;Scalable Vector Graphics (SVG) Demo&lt;/title&gt;
    &lt;circle cx="100" cy="100" r="50" stroke="#000" stroke-width="1" fill="#ccc" /&gt;
    &lt;rect x="200" y="50" width="250" height="100" rx="5" ry="5"
          stroke="#000" stroke-width="1" fill="#ccc" /&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>[Update] It appears that the problem lies in the way the svg is read from the Storage File. I'll post my own answer as soon as I have enough that it might be useful to someone.</p>