Compiler Error CS0411 The type arguments for method ‘method’ cannot be inferred from the usage. Try specifying the type arguments explicitly.

PS: English version is at the bottom.

The type arguments for method ‘IModelExpressionProvider.CreateModelExpression<TModel, TValue>(ViewDataDictionary<TModel>, Expression<Func<TModel, TValue>>)’ cannot be inferred from the usage. Try specifying the type arguments explicitly.   

Hata 3 tane gorunuyor. Ne bir satır numarası var ne bir başka detay. Sadece hatanın hangi ekranda olduğunu gösteriyor. Ama çift tıklıyorum her hangi bir satıra da gitmiyor tabii ki.

Internette biraz araştırınca Microsoft linkinde anlatılan konu ile pek alakalı olmadığını fark ediyorsunuz. https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0411

Biraz daha detaylarına indiğimizde, stackoverflow yorumları arasında dolaştığımızda hatanın HTML helperda tanımlanan ismin modeldeki property isimleri ile eşleşmemesinden kaynaklandığını öğrendim. Koda tekrar alıcı gözü ile baktığımda sınıf tanımı içinde yerini değiştirdiğim bir alt sınıftan dolayı değiştirmeyi atladığım form elemanmlarından dolayı olduğunu fark ettim.

Yaşanan kısa bir sinir harbinden sonra sorunu çözmenin rahatlığı ile işe geri dönüp devam edebildim. 😀

ENGLISH:

The type arguments for method ‘IModelExpressionProvider.CreateModelExpression<TModel, TValue>(ViewDataDictionary<TModel>, Expression<Func<TModel, TValue>>)’ cannot be inferred from the usage. Try specifying the type arguments explicitly.

There are 3 errors. There is no line number or any other detail. It just shows which screen the error is on. But when I double click it, it doesn’t go to any line, of course.

When you do some research on the internet, you realize that it is not very relevant to the subject described in the Microsoft link. https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0411

When we went into some more details, and scrolling through the stackoverflow comments, I learned that the error was caused by the name defined in the HTML helper not matching the property names in the model. When I looked at the code again with the eye of the receiver, I realized that it was because of the form elements that I skipped changing due to a subclass that I changed its place in the class definition.

After a short war of nerves, I was able to go back to work with the comfort of solving the problem. 😀

Posts created 141

Leave a Reply

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top