标签: missingmethod

找不到方法:'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider'

在我的 .net Core 应用程序的 Main 方法中,我收到此错误,我不知道应该在哪里寻找解决方案。

这是我的主要方法:

 public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .UseApplicationInsights()
            .Build();

        host.Run();
    }
Run Code Online (Sandbox Code Playgroud)

这是我在按 F5 启动项目时收到的错误消息:

System.MissingMethodException: 'Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.'
Run Code Online (Sandbox Code Playgroud)

build-error methodnotfound missingmethod .net-core

5
推荐指数
3
解决办法
8768
查看次数

JSONObject keySet() 函数不存在吗?

很困惑。新建项目,添加以下代码:

import org.json.JSONObject;

JSONObject jsonObject = new JSONObject();
jsonObject.keys();
jsonObject.keySet();
Run Code Online (Sandbox Code Playgroud)

.keys()方法按其应有的方式解析。

.keySet()方法突出显示红色,AndroidStudio 给出“无法解析方法 keyset()”错误。

如果我转到keys()定义,这里它们都是公开的:http://goloskok.com/u/2015-07-01_16-41-08.jpg

我究竟做错了什么?

java android json keyset missingmethod

5
推荐指数
1
解决办法
3860
查看次数

如何使Groovy类看起来像Map to Java代码而不显式实现Map接口

我想实现一个自定义的类类,其中大部分功能都委托给嵌套的Map委托实例.而且,我希望这个类看起来像一个Map到一个"真正的"Java类.因此我尝试执行以下操作:

class ConfigurationMap implements Map {
    def inner = [:]

    def methodMissing(String methodName,methodArgs) {
        return inner.invokeMethod(methodName,methodArgs)
    }

    // my methods here
    ...
Run Code Online (Sandbox Code Playgroud)

当然,这不起作用:-(Groovy要求类实现Map接口方法,尽管在运行时它们将由missedMissing()处理.如果我删除implements子句:

class ConfigurationMap {
    def inner = [:]

    def methodMissing(String methodName,methodArgs) {
        return inner.invokeMethod(methodName,methodArgs)
    }
Run Code Online (Sandbox Code Playgroud)

它适用于Groovy(即实例的行为类似于Map),但我不能将它用作Java代码中的Map:

ConfigurationMap cm = ConfigParser.parseConfig("foo.cfg");
assertEquals(0,cm.size()); // size() method is not defined :-(
Run Code Online (Sandbox Code Playgroud)

并建议我如何保持我的课程简短(即不明确地实现Map),并仍然使该类看起来像Map到Java?

groovy interface missingmethod

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