System.MissingMethodException:找不到方法

时间:2016-11-24 17:29:54

标签: windows-10-universal uwp-xaml win2d

在Windows 10上,我正在开发一款通用应用。我有一个项目从build 10240到Anniversary Edition(14393)。我正在使用nuget Win2d.uwp并在调试和发布中开发应用程序时一切正常。我可以生成一个Store包,通过HockeyApp进行部署,它运行得很好。当我将它上传到商店,并等到它被批准后,下载它,并开始使用它,只要我使用Win2d.uwp在一些控件中绘制阴影 和这段代码:

 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;
    }

它惨遭打破并抛出这个异常打破整个应用程序:

System.MissingMethodException: Method not found: 'Void Windows.UI.Composition.DropShadow.put_Offset(System.Numerics.Vector3)'.

它只发生在STORE版本中,我没有用.Net Native编译它。有任何想法吗?

0 个答案:

没有答案