I have a project in VB.NET targeting the 4.7.2 version of the .NET Framework. Its a ASP WebForms project (yes! poor me) that is deployed to IIS.
Now I'm the process of cleaning up the place. And I was intending to use auto implemented properties in model classes to reduce the amount of, already too much, VB code.
It works fine under development. But I can't, for the life of me, understand why its not working in the production environment.
The problem boils down the a class like so:
Public Class ValorAtributo
Public Sub New(codigo As String, descricao As String)
Me.Codigo = codigo
Me.Descricao = descricao
End Sub
Public ReadOnly Property Codigo As String
Public ReadOnly Property Descricao As String
End Class
In the IIS production server it fails in the line Me.Descricao = descricao
, with the following message:
BC30456: 'Descricao' is not a member of 'PesquisaAtributo.ValorAtributo'.
Investigating the IIS deployment
I'm very much confused by all the .NET flavors and where exactly do they play a role. My understanding here is that IIS uses the .NET CLR and not the .NET Framework. But thats at least half said, along with the previous message, one can see the production IIS is using a different version.
Microsoft .NET Framework Versão:4.0.30319; Versão do ASP.NET:4.7.3535.0
This is confusing since the web config file only mentions .NET 4.7.2.
<compilation debug="true" strict="false" explicit="true" targetFramework="4.7.2">
...
<httpRuntime targetFramework="4.7.2" maxRequestLength="15360"/>
To add to the confusion, the app pools on IIS only shows .NET up to 4.0 (CLR this time, no mention of .NET Framework I could find).
Atempting a solution
So I need (want) to use auto implemented properties. There must be a fix for this.
My informed guess is that this is caused by an outdated .NET Framework. However I'm not getting what exactly I should do. I've read conflicting versions of how exactly this works, IIS uses CLR vs uses .NET. In short, its a mess.
Can anyone of you highly efficient Microsoft devs enlight me in what am I missing here?
updates
looking further
There is a longer trace in the web version of the exception I missed when initially writing the post.
It is very long, SO was playing tricks, here is a pastebin for it. https://pastebin.com/1NhY6SMa
a previous, yet maybe similar? issue
VB Auto Implemented Property not compiling
out of the blue
The code was previously compilling and working fine. I could try and use git to try and figure out what happened, what I cn say for sure is that this file had not changed since.