错误“框架不在模块中". Xamarin.Forms中-Android项目 [英] Error "Frame not in module." in Xamarin.Forms - Android project

查看:88
本文介绍了错误“框架不在模块中". Xamarin.Forms中-Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要涉及到此行,就会出现此错误:

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

VS中出现一个新标签,上面写着框架不在模块中".

A new tab appears in VS that says "Frame not in module."

只要线程到达using行,就会发生这种情况.

It happens whenever the thread arrives at the using line.

框架不在模块中

这是完整的代码...

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. 更改链接选项->清理->构建
  2. 更改快速部署->构建
  3. 确保已生成mdb文件并切换调试信息 生成所有/pdb文件并重建
  4. 异常设置->通用语言运行时异常(应打勾)如果未选中,请在父级别上打钩,以便在其下的所有内容都被打上
  5. 工具->选项->调试->常规->启用我的代码 (已勾选)
  6. 如果它们都不起作用,请尝试跳过(F10)而不是单步执行 进入(F11)
  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
  4. Exception settings -> Common Language Runtime Exceptions (should be ticked) If unticked tick the parent level so that everything below it is ticked
  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)

希望至少有一种解决方案有效!

Hopefully atleast one solution works!!

这篇关于错误“框架不在模块中". Xamarin.Forms中-Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆