On Windows 10 I'm developing a universal app. I have a project targeting from build 10240 to the Anniversary Edition(14393). I'm using the nuget Win2d.uwp and whilst developing the app in debug and release everything works fine. I can generate a Store package, deploy it through HockeyApp and it work just fine. When I upload it to the store, and wait until it has been approved, download it, and start to use it, as soon as I draw a shadow in some controls using Win2d.uwp and this code:
public static void InitializeDropShadow(UIElement shadowHost, UIElement shadowTarget, Color color, ShadowPosition position)
{
var offset = GetOffset(position);
var hostVisual = ElementCompositionPreview.GetElementVisual(shadowHost);
var compositor = hostVisual.Compositor;
// Create a drop shadow
var dropShadow = compositor.CreateDropShadow();
dropShadow.Color = Color.FromArgb(color.A, color.B, color.G, color.R);
dropShadow.BlurRadius = 25.0f;
dropShadow.Offset = offset;
// Associate the shape of the shadow with the shape of the target element
// dropShadow.Mask = shadowTarget.GetAlphaMask();
// Create a Visual to hold the shadow
var shadowVisual = compositor.CreateSpriteVisual();
shadowVisual.Shadow = dropShadow;
// Add the shadow as a child of the host in the visual tree
ElementCompositionPreview.SetElementChildVisual(shadowHost, shadowVisual);
// Make sure size of shadow host and shadow visual always stay in sync
var bindSizeAnimation = compositor.CreateExpressionAnimation("hostVisual.Size");
bindSizeAnimation.SetReferenceParameter("hostVisual", hostVisual);
shadowVisual.StartAnimation("Size", bindSizeAnimation);
}
private static Vector3 GetOffset(ShadowPosition position)
{
var result = new Vector3();
switch (position)
{
case ShadowPosition.Center:
result = new Vector3(0, 0, 0);
break;
case ShadowPosition.Top:
result = new Vector3(0, -SHADOW_OFFSET, 0);
break;
case ShadowPosition.Left:
result = new Vector3(-SHADOW_OFFSET, 0, 0);
break;
case ShadowPosition.Right:
result = new Vector3(SHADOW_OFFSET, 0, 0);
break;
case ShadowPosition.Bottom:
result = new Vector3(0, SHADOW_OFFSET, 0);
break;
case ShadowPosition.TopLeft:
result = new Vector3(-SHADOW_OFFSET, -SHADOW_OFFSET, 0);
break;
case ShadowPosition.BottomRight:
result = new Vector3(SHADOW_OFFSET, SHADOW_OFFSET, 0);
break;
default:
result = new Vector3(0, 0, 0);
break;
}
return result;
}
it breaks miserably and throw this exception breaking the whole app:
System.MissingMethodException: Method not found: 'Void Windows.UI.Composition.DropShadow.put_Offset(System.Numerics.Vector3)'.
It only happens from the STORE version and I'm not compiling it with .Net Native. Any Ideas?