简体   繁体   中英

System.Argument Exception When Trying to Render

I'm trying to save a snapshot of each slide in the current project as an image file. As part of this, I want to use a RenderTargetBitmap to get a Grid and its content. Here's the xaml in the UserControl that I'm using as a template for each slide:

<Grid Background="White" Opacity="0.8" x:Name="ContentGrid">
    <!-- Inking area -->
    <InkCanvas x:Name="inkCanvas"/>
</Grid>

And I'm using this to try to get it:

RenderTargetBitmap b = new RenderTargetBitmap();
await b.RenderAsync(ContentGrid, 720, 480);

I'm then looping through the collection of slides, calling the method on each one.

However, it always throws an error on the RenderAsync method. The exception is:

Value does not fall within the expected range.

I've used this method before, and it always worked just fine. The only thing different is that I have an InkCanvas in the Grid , but I don't see how that would affect anything.

EDIT: Interestingly, even just creating a blank Grid with no properties set and trying to render it throws the same exception.

I work on the .NET Native runtime and compiler team. I suspect that we've mistakenly stripped off the setter or getter from one of the properties on your UI type. Stopping on all first chance exceptions should show you a stack that has some PropertyInfo/reflection looking goop right before the throw. If so, this can be corrected by adding a few lines to your Default.rd.xml. In particular a few lines like:

<Type Name="Full.Namespace.And.Name.Of.UIType" Dynamic="Required All"/>
<Type Name="Full.Namespace.And.Name.Of.OtherUIType" Dynamic="Required All"/>
...

If you cannot get it resolved, email us at dotnetnative@microsoft.com and hopfully get you sorted out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM