2010-02-12 72 views
1

有人知道這是什麼嗎?我無法讓它消失。通用與錯誤數量的參數使用錯誤?

•model {「通用類型'System.Web.Mvc.ViewUserControl`1'在程序集'System.Web.Mvc中使用了錯誤數量的泛型參數... 它發生在我調用新。構建的模型,我通過一個局部視圖,並嘗試使用/調用它的一些方法在視圖

這是我的用戶聲明:

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

編輯:

我看到它在vs2010,但代碼仍然運行,但它顯示了這個錯誤或在斷點上,但它仍然運行並按要求運行,但我仍然擔心並想知道我是否在做一些根本性錯誤。谷歌搜索這真的沒有什麼回報,但像我的另一個問題已經完全沒有答案!必須有人知道發生了什麼,而不是整個世界的一個答案。並一般性地處理了錯誤消息,刪除了ViewUserControl`1部分,當然還有組件名稱!哇!! -

+0

我需要爲addDavAction類創建一個「新」構造函數嗎? – 2010-02-12 08:36:06

+0

你能提供完整的堆棧跟蹤嗎? – PanJanek 2010-02-12 08:50:04

+0

代碼仍然運行,但它有這個錯誤,我如何包括堆棧跟蹤? – 2010-02-12 09:50:31

回答

1

我不熟悉'System.Web.Mvc.ViewUserControl',但是,當我嘗試將一個字符串屬性傳遞給單位化的DBCommand.CommandText時,我有類似的錯誤。也許你的ViewUserControl是未初始化的。

錯誤代碼:

「+ StringProperty {」 通用型 「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" } 字符串

原始代碼:

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

的修復:

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 

這可能不是確切的問題,但錯誤代碼是非常相似的,所以我想我會分享解決過這個線程的任何人來。我工作的類是泛型類,因此是泛型運行時錯誤。

+1

嗨,感謝您分享這個,也許布萊德威爾遜,菲爾哈克或斯科特格思裏應該看看它。可能的錯誤或無證打破的變化vs – 2010-11-28 05:08:12

+0

我不確定它是否有錯誤。我認爲錯誤信息正確地反映了代碼。但是,對錯誤消息的可讀性的改進會很好。 – 2010-12-07 22:21:47