这是一个特别在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) 我正在尝试使用HttpClient在Universal Windows项目(在Windows 10通用应用程序中)实现REST客户端,但是以下行:
var response = _client.GetAsync(address).Result;
Run Code Online (Sandbox Code Playgroud)
使用以下消息抛出AggregateException:
拒绝访问.访问此网络资源需要网络功能
更令人惊讶的是,请求不是发送到服务器的事件.我怎么解决这个问题?
什么在UWP中使用,Binding或者x:Bind它们之间有什么区别?
因为我看到人们使用的很多帖子,Binding我只x:Bind在UWP中绑定.
在MSDN首页只说:"通过创建装订物体{x:Bind}并{Binding}在很大程度上是功能相当的." 那x:Bind是快.
但它们之间有什么区别?
因为"在很大程度上与功能相当"并不意味着相当.
我的报价链接:MSDN
所以我的问题是:
使用Binding或x有什么区别:在UWP中绑定?
我听说过
所有这些都被解释为"完整.Net的一个子集,允许您定位多个平台".所以我的问题是
(我的具体情况:我有一个针对.Net 2.0,.Net 4.5和UWP的库.针对UWP需要创建一个新的VS项目并链接所有现有文件,这是一个巨大的痛苦.现在有人告诉我它没有不适用于PCL,从它的声音我必须再次为.Net标准!?)
有没有办法写入控制台/命令提示符/ powershell(如Console.WriteLine())或UWP应用程序中的类似内容?
如果控制台不可用,那么我可以使用一个合适的替代方法来向屏幕写入大量文本吗?
当然,我可以对它进行XAML控制并输出,但与简单相比,它似乎并不方便Console.WriteLine().
关于WPF控制台也有很老的讨论,但似乎没有任何工作(至少,我找不到Project-Properties-Application tab-Output Type-Console Application并且Trace.WriteLine("text")不可用).
我们将以下代码在我们的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或更高版本通过其推断名称访问元素.
知道为什么以及如何解决这个问题?
虽然我可以使用以下代码获得程序集版本
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,但这不适合我
我在使用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) 卸载程序时,我看到数百个名为"NoUIEntryPoints-DesignMode"的软件包.根据我的研究结果,我已经认识到如果您调试UWP-App注册文件扩展名,它将创建此包,系统无法删除它.
我该怎么删除它们?
基于通用Windows平台(UWP)构建的Windows 10应用程序是否可以移植回Windows 7客户?特别是,使用XAML制作的?