标签: uwp

什么可能导致P/Invoke参数在传递时出现故障?

这是一个特别在ARM上发生的问题,而不是在x86或x64上.我有这个用户报告的问题,并且能够通过Windows IoT在Raspberry Pi 2上使用UWP重现它.我在使用不匹配的调用约定之前已经看到过这种问题,但是我在P/Invoke声明中指定了Cdecl,我尝试在原生端显式添加__cdecl并获得相同的结果.这是一些信息:

P/Invoke声明(参考):

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern FLSliceResult FLEncoder_Finish(FLEncoder* encoder, FLError* outError);
Run Code Online (Sandbox Code Playgroud)

C#结构(参考):

internal unsafe partial struct FLSliceResult
{
    public void* buf;
    private UIntPtr _size;

    public ulong size
    {
        get {
            return _size.ToUInt64();
        }
        set {
            _size = (UIntPtr)value;
        }
    }
}

internal enum FLError
{
    NoError = 0,
    MemoryError,
    OutOfRange,
    InvalidData,
    EncodeError,
    JSONError,
    UnknownValue,
    InternalError,
    NotFound,
    SharedKeysStateError,
}

internal unsafe struct FLEncoder
{
}
Run Code Online (Sandbox Code Playgroud)

C头中的函数(参考)

FLSliceResult FLEncoder_Finish(FLEncoder, FLError*); …
Run Code Online (Sandbox Code Playgroud)

c# windows pinvoke arm uwp

80
推荐指数
1
解决办法
2095
查看次数

通用Windows项目 - HttpClient异常

我正在尝试使用HttpClient在Universal Windows项目(在Windows 10通用应用程序中)实现REST客户端,但是以下行:

var response = _client.GetAsync(address).Result;
Run Code Online (Sandbox Code Playgroud)

使用以下消息抛出AggregateException:

拒绝访问.访问此网络资源需要网络功能

更令人惊讶的是,请求不是发送到服务器的事件.我怎么解决这个问题?

.net c# win-universal-app windows-10 uwp

48
推荐指数
1
解决办法
1万
查看次数

绑定和x之间的区别:绑定

什么在UWP中使用,Binding或者x:Bind它们之间有什么区别?

因为我看到人们使用的很多帖子,Binding我只x:Bind在UWP中绑定.

在MSDN首页只说:"通过创建装订物体{x:Bind}{Binding}在很大程度上是功能相当的." 那x:Bind.

但它们之间有什么区别?

因为"在很大程度上与功能相当"并不意味着相当.

我的报价链接:MSDN

所以我的问题是:

使用Binding或x有什么区别:在UWP中绑定?

data-binding xaml win-universal-app uwp

47
推荐指数
2
解决办法
9448
查看次数

.Net Core,Portable,Standard,Compact,UWP和PCL之间的区别?

我听说过

  • .Net核心
  • .Net Portable
  • .Net标准
  • .Net Compact
  • 通用Windows平台
  • 便携式类库

所有这些都被解释为"完整.Net的一个子集,允许您定位多个平台".所以我的问题是

  1. 有什么不同!?
  2. 如果我想编写一个尽可能大的受众群体的库,我需要使用哪一个(或多个)

(我的具体情况:我有一个针对.Net 2.0,.Net 4.5和UWP的库.针对UWP需要创建一个新的VS项目并链接所有现有文件,这是一个巨大的痛苦.现在有人告诉我它没有不适用于PCL,从它的声音我必须再次为.Net标准!?)

.net c# portable-class-library .net-core uwp

46
推荐指数
3
解决办法
6441
查看次数

如何在Windows 10上的UWP中输出到控制台?

有没有办法写入控制台/命令提示符/ powershell(如Console.WriteLine())或UWP应用程序中的类似内容?

如果控制台不可用,那么我可以使用一个合适的替代方法来向屏幕写入大量文本吗?

当然,我可以对它进行XAML控制并输出,但与简单相比,它似乎并不方便Console.WriteLine().

关于WPF控制台也有很老的讨论,但似乎没有任何工作(至少,我找不到Project-Properties-Application tab-Output Type-Console Application并且Trace.WriteLine("text")不可用).

c# console xaml windows-10 uwp

43
推荐指数
1
解决办法
4万
查看次数

获取"元组元素名称是推断的.请使用语言版本7.1或更高版本来通过其推断名称访问元素."

我们将以下代码在我们的UWP应用程序中运行良好,直到今天我们将Visual Studio 2017更新到最新的15.3.

private void Test()
{
    var groups = new List<(Guid key, IList<(string, bool)> items)>();

    var items = new List<(string, bool)>
    {
        ("a", true),
        ("b", false),
        ("c", false)
    };
    var group = (Guid.NewGuid(), items);

    groups.Add(group);
}
Run Code Online (Sandbox Code Playgroud)

输出窗口中没有错误消息

推断元组元素名称'items'.请使用语言版本7.1或更高版本通过其推断名称访问元素.

知道为什么以及如何解决这个问题?

c# visual-studio uwp c#-7.0 visual-studio-2017

41
推荐指数
3
解决办法
6775
查看次数

从Package中检索当前应用程序版本

虽然我可以使用以下代码获得程序集版本

        var assembly = typeof(App).GetTypeInfo().Assembly;
        var assemblyVersion = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
Run Code Online (Sandbox Code Playgroud)

我想从Package.appxmanifest本例1.0.0.4中检索版本

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
  <Identity Name="zzz" Publisher="CN=zzz" Version="1.0.0.4" />
Run Code Online (Sandbox Code Playgroud)

我希望能够访问Windows.ApplicationModel,但这不适合我

c# windows-store windows-store-apps prism-storeapps uwp

36
推荐指数
1
解决办法
2万
查看次数

挂起事件不使用WinRT引发

我在使用WinRT在Windows Phone 8.1上暂停事件时遇到问题,它不会触发.我不知道为什么.这是我的代码:

/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
    InitializeComponent();

    Suspending += OnSuspending;
#if DEBUG
    this.displayRequest = new DisplayRequest();
#endif
}

/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory …
Run Code Online (Sandbox Code Playgroud)

c# windows-runtime windows-phone-8.1 win-universal-app uwp

35
推荐指数
1
解决办法
8360
查看次数

删除NoUIEntryPoints-DesignMode包

卸载程序时,我看到数百个名为"NoUIEntryPoints-DesignMode"的软件包.根据我的研究结果,我已经认识到如果您调试UWP-App注册文件扩展名,它将创建此包,系统无法删除它.

我该怎么删除它们?

目前,"应用和功能"页面如下所示: 在此输入图像描述

debugging file-extension uwp

35
推荐指数
1
解决办法
4458
查看次数

UWP应用程序可以移植到Windows 7吗?

基于通用Windows平台(UWP)构建的Windows 10应用程序是否可以移植回Windows 7客户?特别是,使用XAML制作的?

xaml windows-store-apps uwp

33
推荐指数
1
解决办法
2万
查看次数