我在一个组件中有一个可选参数之后得到System.MissingMethodException的错误,并且调用它的另一个组件没有构建,因为它使用旧的参数调用它.
只有添加了参数的组件才会构建部署为补丁.调用组件是旧的,因为它没有变化.
当调用组件运行时,它会给出错误:
例外信息
异常类型:System.MissingMethodException消息:找不到方法:'LabelURLs IPSD.BnB.Transaction.Postage.GetLabelURLs(System.String)'.数据:System.Collections.ListDictionaryInternal TargetSite:Void GenerateScanForm(Int32,Int32)HelpLink:NULL源:BnBDispenseQueueProcess
据我所知,它不应该引发错误,因为新参数是可选的.还有一件事是调用组件(EXE)作为Windows服务运行.
我们找到了一个非常有线的解决方法来让它运行.通过删除更改的组件一次并运行调用组件,它将说找不到DLL.再次放置相同的DLL并调用组件工作正常:).
我想我错过了.net的一些内部.
如果需要更多信息,请告诉我.
.net c# missingmethodexception optional-parameters vb.net-2010
我有一个具有以下构造函数的类
public DelayCompositeDesigner(DelayComposite CompositeObject)
{
InitializeComponent();
compositeObject = CompositeObject;
}
Run Code Online (Sandbox Code Playgroud)
以及没有参数的默认构造函数.
接下来我正在尝试创建一个实例,但它只能在没有参数的情况下工作:
var designer = Activator.CreateInstance(designerAttribute.Designer);
Run Code Online (Sandbox Code Playgroud)
这工作正常,但如果我想传递参数,它不会:
var designer = Activator.CreateInstance(designerAttribute.Designer, new DelayComposite(4));
Run Code Online (Sandbox Code Playgroud)
这导致MissingMethodException:
未找到构造函数类型Vialis.LightLink.Controller.Scenarios.Composites.DelayCompositeDesigner
这里有什么想法?
问题是我真的需要在施工期间传递一个物体.
你看我有一个设计器,它加载了从中继承的所有类型CompositeBase.然后将这些添加到列表中,用户可以从中将它们拖动到设计器.执行此操作后,将拖动的实例添加到设计器中.这些类中的每一个都定义了自定义属性:
[CompositeMetaData("Delay","Sets the delay between commands",1)]
[CompositeDesigner(typeof(DelayCompositeDesigner))]
public class DelayComposite : CompositeBase
{
}
Run Code Online (Sandbox Code Playgroud)
当用户选择设计器中的项目时,它会查看这些属性以便为该类型加载设计器.例如,在它的情况下,DelayComposite它将加载具有标签和滑块的用户控件,该标签和滑块允许用户设置DelayComposite实例的"延迟"属性.
到目前为止,如果我没有将任何参数传递给构造函数,这可以正常工作.设计者创建一个实例DelayCompositeDesigner并将其分配给WPF的content属性ContentPresenter.
但由于该设计人员需要在设计器中修改所选属性,因此DelayComposite
我必须将此实例传递给它.这就是为什么构造函数看起来像这样:
public DelayCompositeDesigner(DelayComposite CompositeObject)
{
InitializeComponent();
compositeObject = CompositeObject;
}
Run Code Online (Sandbox Code Playgroud)
欢迎提出建议
@VolkerK
您的代码的结果是这样的:
<---- foo Vialis.LightLink.Controller.Scenarios.Composites.DelayCompositeDesignerVoid .ctor()Vialis.LightLink.Controller.Scenarios.Composites.DelayCompositeDesignerVoid .ctor(Vialis.LightLink.Controller.Scenarios.Composites.DelayComposite)param:Vialis .LightLink.Controller.Scenarios.Composites.DelayComposite foo ---->
Leppie,你是对的,我出于某种原因在我的UI应用程序中引用了Composites程序集......这不是我在运行时加载它时应该做的事情.以下代码有效:
object …Run Code Online (Sandbox Code Playgroud) 我在ClickOnce部署的应用程序中依赖于.NET 2.0 SP2(该ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate(false)方法仅适用于SP2).
我想检查应用启动期间SP2是否存在.我试图通过在调用仅SP2方法后捕获MissingMethodException来检测这一点.
/// <summary>
/// The SP2 bootstrapper does not allow HomeSite installation
/// http://msdn.microsoft.com/en-us/vstudio/bb898654.aspx
/// So we only advice the user to download .NET 2.0 SP2 manually.
/// </summary>
private void CheckDotNet2SP()
{
WaitHandle wh = new AutoResetEvent(true);
try
{
wh.WaitOne(1); //this method is .NET 2.0 SP2 only
}
//NOTE: this catch does not catch the MissingMethodException
catch (Exception) //change to catch(MissingMethodException) does not help
{
//report that .NET 2.0 SP2 is missing
}
finally …Run Code Online (Sandbox Code Playgroud) 将TypeNameAssemblyFormat与PCL一起使用是否有问题?使用Newtonsoft.Json时,我没有任何问题,除非我使用此序列化设置.
这是我的Json相关代码:
var settings = new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.Objects,
Formatting = Formatting.Indented,
TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full
};
var json = JsonConvert.SerializeObject(obj, settings);
var jsonBytes = Encoding.UTF8.GetBytes(json);
return jsonBytes;
Run Code Online (Sandbox Code Playgroud)
当我在声明它的同一个库中进行调用时,它很好.但是,当我从调用上述代码的其他PCL进行调用时,我得到了缺少的方法异常.这只发生在我使用TypeNameAssemblyFormat设置时(即如果我不必使用该设置,那么我就不会写这篇文章了;).
我正在使用PCL简介7.
例外(我不想吹嘘整个堆栈跟踪,但我可以,如果有人认为这会有所帮助):
"System.MissingMethodException: Method not found: 'Void Newtonsoft.Json.JsonSerializerSettings.set_TypeNameAssemblyFormat(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)'
Run Code Online (Sandbox Code Playgroud) serialization json missingmethodexception json.net portable-class-library
我按照一切从以下链接: https://developer.xamarin.com/guides/xamarin-forms/user-interface/navigation/master-detail-page/ 我写的代码可以在这里找到:HTTP:// github.com/foyzulkarim/XamarinFormsDrawer 我成功地使用UWP项目部署在同一个项目中我的Windows 10本地机器上,但每当我想在模拟器部署,或在我的设备,它抛出以下异常.
System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found.
09-17 17:16:33.636 D/Mono (10472): DllImport attempting to load: '/system/lib/liblog.so'.
09-17 17:16:33.637 D/Mono (10472): DllImport loaded library '/system/lib/liblog.so'.
09-17 17:16:33.637 D/Mono (10472): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
09-17 17:16:33.637 D/Mono (10472): Searching for '__android_log_print'.
09-17 17:16:33.637 D/Mono (10472): Probing '__android_log_print'.
09-17 17:16:33.637 D/Mono (10472): Found as '__android_log_print'.
09-17 17:16:33.645 I/MonoDroid(10472): UNHANDLED EXCEPTION:
09-17 17:16:33.658 I/MonoDroid(10472): System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found.
09-17 17:16:33.658 I/MonoDroid(10472): at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in …Run Code Online (Sandbox Code Playgroud) android missingmethodexception xamarin.android navigation-drawer xamarin.forms
所以我刚刚开始使用F#,我遇到了一个非常奇怪的问题,当我使用FSharp PowerPack中的某些方法时会抛出System.MissingMethodException.
对于同一模块中的所有方法都不会发生这种情况.如果我将程序集编译为Application而不是类库,也不会发生这种情况.
复制步骤:
在每个装配中创建以下测试夹具.
open NUnit.Framework
[<TestFixture>]
type Tests() = class
[<Test>]
member self.OfSeq() =
// Will always succeed
Matrix.Generic.ofSeq [[1]] |> ignore
[<Test>]
member self.OfList() =
// Will fail under certain conditions with a System.MissingMethodException
Matrix.Generic.ofList [[1]] |> ignore
end
Run Code Online (Sandbox Code Playgroud)当我这样做时,应用程序运行正常(所有测试都通过),但类库失败,出现以下异常:
System.MissingMethodException : Method not found: 'Microsoft.FSharp.Math.Matrix`1<!!0> Generic.ofList(Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Collections.FSharpList`1<!!0>>)'.
at Temp2.Tests.OfList()
Run Code Online (Sandbox Code Playgroud)
这里发生了什么?
产生问题的另一种方法是matrix.PermuteColumns.
附加信息:
如果有其他信息可以使用,请告诉我.
当我在控制台中运行以下代码时(groovy 2.1.3):
strings = [ "butter", "bread", "dragon", "table" ]
strings.eachParallel{println "$it0"}
Run Code Online (Sandbox Code Playgroud)
我明白了:
groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.eachParallel() is applicable for argument types: (ConsoleScript40$_run_closure1) values: [ConsoleScript40$_run_closure1@a826f5]
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我做错了什么?
我有一个NUnit单元测试,它是用普通的F#库编写的,但它是针对可移植类库中的F#代码.
当我运行此测试(在Visual Studio 2013中)时,我得到以下异常:
Result Message: System.MissingMethodException : Method not found:
'Microsoft.FSharp.Control.FSharpAsync`1<System.IO.TextReader> FSharp.Data.Runtime.IO.asyncReadTextAtRuntime(System.Boolean, System.String, System.String, System.String, System.String)'.
Run Code Online (Sandbox Code Playgroud)
这就是我在Portable Class Library中的app.config中所拥有的:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这就是我在普通F#库的app.config中所拥有的:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我正在开发一个设备应用程序,使用与"常规"Sql Server 2005(不是Compact DB)的连接.每当我尝试在Windows CE(Datalogic Memor CE)上打开SqlConnection时,我都会得到MissingMethodException:Can't find PInvoke DLL 'dbnetlib.dll'..
这似乎是一个部署问题.在我的项目中,我包括:
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\Client\System.Data.SqlClient.dll
文件System.Data.SqlClient.dll确实部署到我的应用程序目录,但没有任何迹象dbnetlib.dll.
当我谷歌这个例外时,我主要得到以下建议:
Devices\Client-directory由'SQL Server Compact 3.5 for Windows Mobile'(SSCEDeviceRuntime-ENU.msi)安装,我下载并尝试取消并重新安装基本版本SP1和SP2,但仍然没有部署差异..cab(像sql.wce5.armv4i.CAB),这dbnetlib.dll从如复制C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\Client\wce500\armv4i到一个持久的启动目录下(如\Backup\Startup在此Datalogic的).
dbnetlib.dll,因为System.Data.SqlClient.dll确实已部署.
我试图用所享有与NUnit的为测试运行.测试用例取自" 入门",并在NUnit外部运行时按预期工作:
namespace FsTest.Tests
open NUnit.Framework
open Swensen.Unquote
[<TestFixture>]
module Example =
[<Test>]
let foo() =
test <@ (1+2)/3 = 1 @>
Run Code Online (Sandbox Code Playgroud)
在NUnit下我得到这个例外:
FsTest.Tests.Example.foo:System.MissingMethodException:找不到方法:'System.Tuple
2<Microsoft.FSharp.Collections.FSharpList1,Microsoft.FSharp.Quotations.FSharpExpr> Internal.reduceFullyAndGetLast(Microsoft.FSharp.Quotations.FSharpExpr)'.
我想知道上面的代码是否有任何问题以及如何使其工作.raise如果有帮助的话,Unquote 对我来说也是失败的.
.net ×3
c# ×3
f# ×3
.net-2.0 ×1
activator ×1
android ×1
clr ×1
dll ×1
f#-data ×1
f#-powerpack ×1
f#-unquote ×1
gpars ×1
groovy ×1
install ×1
json ×1
json.net ×1
nunit ×1
vb.net-2010 ×1
windows-ce ×1