C# 无法激活windows应用商店应用。未知错误:0x80040200
这个项目是基于Windows10 IoCore“Hello World”Damo。我想用纯rgb字节数组显示图像。所以我在这里添加了我的代码C# 无法激活windows应用商店应用。未知错误:0x80040200,c#,visual-studio,uwp,windows-10-iot-core,C#,Visual Studio,Uwp,Windows 10 Iot Core,这个项目是基于Windows10 IoCore“Hello World”Damo。我想用纯rgb字节数组显示图像。所以我在这里添加了我的代码 public async void Func() { int ret; uint mode, x, y, width, height; mode = x = y = width = height = 0; ret = Roseek_ImageAcquisition_GetResolut
public async void Func()
{
int ret;
uint mode, x, y, width, height;
mode = x = y = width = height = 0;
ret = Roseek_ImageAcquisition_GetResolution(ref mode, ref x, ref y, ref width, ref height);
RunFlag = true;
uint buffsize = width * height * 3;
RawFrameInfo frameinfo = new RawFrameInfo();
byte[] Framebytes = new byte[buffsize];
byte[] bgra = new byte[width * height * 4];
while (RunFlag)
{
ret = Roseek_ImageAcquisition_FetchFrame(Framebytes, buffsize, ref frameinfo, 1000);
if (ret == 0)
{
pFrameToRGB(Framebytes, bgra, (int)width, (int)height);
/* IBuffer ibuf = new Windows.Storage.Streams.Buffer(width * height * 4);
bgra.CopyTo(ibuf);
SoftwareBitmap image = SoftwareBitmap.CreateCopyFromBuffer(ibuf, BitmapPixelFormat.Bgra8, (int)width, (int)height, BitmapAlphaMode.Ignore);
SoftwareBitmapSource sf = new SoftwareBitmapSource();
await sf.SetBitmapAsync(image);*/
using (IRandomAccessStream RandomAccessStream = new InMemoryRandomAccessStream())
{
BitmapEncoder encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.BmpEncoderId, RandomAccessStream);
encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore, width, height, 96, 96, bgra);
await encoder.FlushAsync();
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async () =>
{
var image = new BitmapImage();
await image.SetSourceAsync(RandomAccessStream);
}) ;
}
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
{
HelloMessage.Text = "While Loop! FetchFrame OK!";
});
}
}
一些“Roseek”函数来自另一个DLL。我认为while循环中可能添加了一些错误的代码。我调试了很多次这个应用程序,它是好的。当我修改并继续远程调试此应用程序时,出现了一些示例错误,如“Memery out”。之后,我无法永远激活应用程序,但应用程序已安装在IoT设备中。我尝试重新启动或卸载应用程序,但无法工作。
我是在IoToCore上开发UWP的新手。那么我能问一下我在循环中添加了一些错误的代码吗?我在使用VS2017/Xamarin任何模板时都会遇到同样的错误&应用程序加载到手机上的UWP,然后它崩溃了。
所以我想说你的代码没有问题。微软不再支持Winphone;)在我不受支持的Winphone上重新启动它使它重新工作了我在任务和任务中使用了Fun()。start()这个问题发生后,你能在桌面上调试这个应用程序吗?错误“内存耗尽”是什么时候发生的"发生?你能显示一些详细信息吗?是的,没有任何错误。但是位置调试环境和远程调试环境不一样。当我在位置调试这个应用程序时,我发现应用程序的进程内存越来越大,甚至超过5g。所以我想错误的代码是我的第一个问题。修改后我会再次远程调试应用程序这个问题。