简体   繁体   English

错误“框架不在模块中”。 在 Xamarin.Forms - Android 项目中

[英]Error "Frame not in module." in Xamarin.Forms - Android project

Whenever it comes to this line, this error appears:每当涉及到这一行,就会出现这个错误:

using (var client = new HttpClient())
{
    var json = await client.GetStringAsync("http://mvalivros.azurewebsites.net/api/livros");
    var livros = JsonConvert.DeserializeObject<List<Model.Livro>>(json);
    return livros;
}

A new tab appears in VS that says "Frame not in module." VS 中出现一个新选项卡,显示“框架不在模块中”。

It happens whenever the thread arrives at the using line.每当线程到达using行时就会发生这种情况。

Frame not in module框架不在模块中

This is code complete...这是代码完整...

using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace LivrosApp.ApiLivros
{
    public static class Api
    {
        public static async Task<IList<Model.Livro>> GetAsync()
        {
            using (var client = new HttpClient())
            {
                var json = await client.GetStringAsync("http://mvalivros.azurewebsites.net/api/livros");
                var livros = JsonConvert.DeserializeObject<List<Model.Livro>>(json);
                return livros;
            }
        }
    }
}

Annoying when this happens!!发生这种情况时很烦人!!
There is not one solution to this, have had this issue in past and few things you can try:对此没有一种解决方案,过去曾遇到过此问题,您可以尝试一些方法:

  1. Change linking options -->Clean -->build更改链接选项 --> 清理 --> 构建
  2. Change fast deployment --> build更改快速部署 --> 构建
  3. Make sure mdb files are been generated and switch debug info generation to all/pdb files and rebuild确保生成了 mdb 文件并将调试信息生成切换到所有/pdb 文件并重建
  4. Exception settings -> Common Language Runtime Exceptions (should be ticked) If unticked tick the parent level so that everything below it is ticked Exception settings -> Common Language Runtime Exceptions (should be tick) 如果取消勾选父级别,以便它下面的所有内容都被勾选
  5. Tools -> Options -> Debugging -> General -> Enable Just My Code (Ticked)工具 -> 选项 -> 调试 -> 常规 -> 仅启用我的代码(已打勾)
  6. If none of them works then try stepping over (F10) instead of step into (F11)如果它们都不起作用,请尝试跨步(F10)而不是步入(F11)

Hopefully atleast one solution works!!希望至少一种解决方案有效!!

I had the same problem and it worked for me after I make the following change.我遇到了同样的问题,在我进行以下更改后它对我有用。

Go to Debug -> Exceptions -> Uncheck Common Language Runtime Exception转到调试 -> 异常 -> 取消选中公共语言运行时异常

Source where I get the solution from: Debbuger doesn't work frame not in module.我从中获得解决方案的来源: Debbuger 不工作框架不在模块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM