dimanche 25 juin 2017

.Net Core MVC ViewModel weird behavior. Can't access its properties. Error CS0103: The name {X} does not exist in this context.

The behavior was noticed when I set the code on the image below, for a condition based on the actual state of the ViewModel set for this View. The condition is never true. So, trying to figure out whats is going on, I'm impressed with what I saw:

image of the code being debugged

As you can see, in the same line, checking for the Model, it is not null and has a property 'Message' with not null string. But the second part of the expression, where I check for the state of this 'Message property', it is null, with the message:

    Error CS0103: The name 'Message' does not exist in this context. 

This is actually my first project using .Net Core MVC 6 on Visual Studio 2017 Community (for Mac OS X, Version 7.0.1 (build 24)). Maybe something changed, perhaps with the binding process, but I can't figure it out how to solve this.

As an additional information, these are the first lines of this View code:

    @using CMB_Web.Models.Views.Shared
    @model ResultViewModel<object>




Aucun commentaire:

Enregistrer un commentaire