泛型使用错误的参数错误?

时间:2022-05-14 23:14:55

Does anyone know what on earth this is? i can't get it to go away.

有谁知道这是什么?我无法让它消失。

•model {"The generic type 'System.Web.Mvc.ViewUserControl`1' was used with the wrong number of generic arguments in assembly 'System.Web.Mvc... it happens when i call a newly constructed model that i pass to a partial view, and try using/calling some methods of it in the view.

•model {“泛型类型'System.Web.Mvc.ViewUserControl`1'与程序集'System.Web.Mvc中错误数量的泛型参数一起使用...当我调用我通过的新构建的模型时它会发生到局部视图,并尝试在视图中使用/调用它的一些方法。

this is my userControl declaration:

这是我的userControl声明:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of FP.AddFavAction)" %>

edit:

i see it in vs2010, but the code still runs yet it shows this error on breakpoint, yet it still runs and function as requested, but i still worry and want to know if i am doing something fundamentally wrong. googling this really returns almost nothing, but another question like mine that has gone totally unanswered!! there's got to be someone that knows whats going on, not one answer in the whole world. and have serched for the error message generically, removing the ViewUserControl`1 part, and of course teh assembly name!! wow!! –

我在vs2010中看到它,但代码仍然运行但它在断点上显示此错误,但它仍然运行并按要求运行,但我仍然担心并想知道我是否做了一些根本错误的事情。谷歌搜索这真的几乎没有任何回报,但另一个像我的问题已完全没有答案!必须有人知道最新情况,而不是整个世界的一个答案。一般来说,删除了ViewUserControl`1部分的错误消息,当然还有程序集名称!哇!! -

1 个解决方案

#1


1  

I am not familiar with 'System.Web.Mvc.ViewUserControl', however, I had a similar error when I attempted to pass a String Property to an unitialized DBCommand.CommandText. Perhaps your ViewUserControl is uninitialized.

我不熟悉'System.Web.Mvc.ViewUserControl',但是,当我尝试将String属性传递给一个统一的DBCommand.CommandText时,我遇到了类似的错误。也许您的ViewUserControl未初始化。

The error code:

错误代码:

"+ StringProperty {"The generic type 'GenericClass1' was used with the wrong number of generic arguments in assembly 'WindowsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":"GenericClass1"} String

“+ StringProperty {”泛型类型'GenericClass1'在程序集'WindowsApplication1,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'中使用了错误数量的泛型参数。“:”GenericClass1“} String

The original code:

原始代码:

Using da As DbDataAdapter = DBFactory.CreateDataAdapter
     da.InsertCommand.CommandText = InsertCommand
     da.InsertCommand.Connection = conn
     da.Update(Me)
End Using

The fix:

Using da As DbDataAdapter = DBFactory.CreateDataAdapter
     da.InsertCommand = DBFactory.CreateCommand
     da.InsertCommand.CommandText = InsertCommand
     da.InsertCommand.Connection = conn
     da.Update(Me)
     da.InsertCommand.Dispose()
End Using 

This might not be the exact problem, but the error code was very similar so I thought I'd share the solution to whomever comes across this thread. The Class I was working in was a Generic Class and thus the generic runtime error.

这可能不是确切的问题,但错误代码非常相似所以我认为我会分享解决方案给任何遇到此线程的人。我正在使用的类是通用类,因此是通用运行时错误。

#1


1  

I am not familiar with 'System.Web.Mvc.ViewUserControl', however, I had a similar error when I attempted to pass a String Property to an unitialized DBCommand.CommandText. Perhaps your ViewUserControl is uninitialized.

我不熟悉'System.Web.Mvc.ViewUserControl',但是,当我尝试将String属性传递给一个统一的DBCommand.CommandText时,我遇到了类似的错误。也许您的ViewUserControl未初始化。

The error code:

错误代码:

"+ StringProperty {"The generic type 'GenericClass1' was used with the wrong number of generic arguments in assembly 'WindowsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":"GenericClass1"} String

“+ StringProperty {”泛型类型'GenericClass1'在程序集'WindowsApplication1,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'中使用了错误数量的泛型参数。“:”GenericClass1“} String

The original code:

原始代码:

Using da As DbDataAdapter = DBFactory.CreateDataAdapter
     da.InsertCommand.CommandText = InsertCommand
     da.InsertCommand.Connection = conn
     da.Update(Me)
End Using

The fix:

Using da As DbDataAdapter = DBFactory.CreateDataAdapter
     da.InsertCommand = DBFactory.CreateCommand
     da.InsertCommand.CommandText = InsertCommand
     da.InsertCommand.Connection = conn
     da.Update(Me)
     da.InsertCommand.Dispose()
End Using 

This might not be the exact problem, but the error code was very similar so I thought I'd share the solution to whomever comes across this thread. The Class I was working in was a Generic Class and thus the generic runtime error.

这可能不是确切的问题,但错误代码非常相似所以我认为我会分享解决方案给任何遇到此线程的人。我正在使用的类是通用类,因此是通用运行时错误。