简体   繁体   中英

generic was used with wrong number of arguments error?

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.

this is my userControl declaration:

<%@ 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!!

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.

The error code:

"+ StringProperty {"The generic type 'GenericClass 1' was used with the wrong number of generic arguments in assembly 'WindowsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":"GenericClass 1"} 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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