U4-9560 - 'System.Dynamic.ExpandoObject' does not contain a definition for 'Alias'

Created by Sebastiaan Janssen 22 Feb 2017, 13:06:15 Updated by Dallas Taylor 03 Mar 2017, 02:53:06

Tags: Unscheduled Regression

Relates to: U4-9493

The bug that seemed fixed in U4-9493 now seems to cause a new error, this time it's capital "A" in "Alias". See comments on U4-9493 for more info.

2 Attachments

Comments

Stephan 22 Feb 2017, 14:52:31

What caused the original issue is I think commit ede342febad2a6777185c64b300c03809490b5e0 which, in PropertyType class ctor, replaced a raw data reader by PetaPoco, becoming case-sensitive in the way.

What's confusing is that "SELECT alias FROM..." can return a dynamic with a property named "Alias" and not "alias".

The PR that was merged for U4-9493 moved from dynamically getting ".alias" (which failed) by ".Alias" (which worked).

Because it looks like magic, I've fixed it differently by doing "SELECT alias as alias FROM..." and then it comes back as "alias". And we can dynamically get ".alias".

Now what I cannot figure out is why some ppl would see an error about the dynamic not containing an "Alias" property... something I cannot reproduce. @crumpled_jeavon @mikkelhm could you check in your database schema what the name of the "alias" column is exactly, "alias" or "Alias"?

It ''could'' also be that different database engine return different casing... in which case my fix ("alias as alias") should fix it for everybody.

PR for tests: https://github.com/umbraco/Umbraco-CMS/pull/1767


Jeavon Leopold 22 Feb 2017, 15:12:17

Capitalised "A" on mine (SQL Server 12.0.4232). Umbraco upgraded 7.4.1 -> 7.4.2 -> 7.4.3 -> 7.5.10


Sebastiaan Janssen 22 Feb 2017, 15:18:41

Same here, capitalized.. upgraded since.. don't know 4.x?


Sebastiaan Janssen 22 Feb 2017, 15:27:11

Issue is indeed fixed now with this new code!

But I got rid of dynamics already so I'll keep it non-dynamic :)


Stephan 22 Feb 2017, 15:36:25

Makes sense that the column is capitalized, it's been like that... forever. Now wondering if it's ''some'' database engines that return "Alias" when you "SELECT alias"... never mind, should be fixed now.


Jeavon Leopold 22 Feb 2017, 15:51:38

Fab, thanks all!


Bo Jacobsen 23 Feb 2017, 14:01:50

Updating from 7.5.6 to 7.5.10 via Nuget get me this error.

https://our.umbraco.org/forum/using-umbraco-and-getting-started/84172-systemdynamicexpandoobject-does-not-contain-a-definition-for-alias


Sebastiaan Janssen 23 Feb 2017, 14:05:55

@bj@synergi1.dk Sorry about that.. it's fixed in 7.5.11 (coming in 1½ weeks) - you can get a nightly build with this fix in it here: https://ci.appveyor.com/project/Umbraco/umbraco-cms-hs8dx/build/6517/artifacts


Sebastiaan Janssen 23 Feb 2017, 14:13:04

I haven't tested this but you could also try to rename the Alias column in your cmsPropertyData table so that the column is name alias (starting with a lower case "a") instead of Alias.

Please make backups of your database before you try that and make sure that you can restore the backup as well in case something goes wrong!


Bo Jacobsen 23 Feb 2017, 14:18:33

@sebastiaan We will use the nightly build if we are in need. Else we will wait for the new release.

Its a defination for Alias it can't find. So i dunno if renaming the column to alias would help?


Sebastiaan Janssen 23 Feb 2017, 14:27:43

Yep, see my comment above yours! :-)


Vilen 28 Feb 2017, 09:18:04

@sebastiaan Same here in 7.5.10, even after renaming Alias in cmsPropertyType(there is no Alias in cmsPropertyData) and rebuilding indexes/.config

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException occurred
  HResult=-2146233088
  Message="System.Dynamic.ExpandoObject" не содержит определения для "Alias"
  Source=Anonymously Hosted DynamicMethods Assembly
  StackTrace:
       в CallSite.Target(Closure , CallSite , Object )
       в System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
       в umbraco.cms.businesslogic.propertytype.PropertyType..ctor(Int32 id)
       в umbraco.cms.businesslogic.property.Property..ctor(Property property)
       в umbraco.cms.businesslogic.Content.<InitializeProperties>b__f(Property x)
       в System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       в System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
       в umbraco.cms.businesslogic.Content.InitializeProperties()
       в umbraco.cms.businesslogic.Content.getProperty(String alias)
       в umbraco.providers.members.UmbracoProfileProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection collection)
       в System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
       в System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
       в System.Configuration.SettingsBase.get_Item(String propertyName)
       в System.Web.Profile.ProfileBase.GetInternal(String propertyName)
       в System.Web.Profile.ProfileBase.get_Item(String propertyName)
       в EIIP.Portal.Web.Model.AccountEditModel.FillFromProfile(ProfileBase profile) в C:\Source\EIIP-portal-new\External Portal\EIIP\EIIP\Model\AccountEditModel.cs:строка 144
  InnerException:


Dallas Taylor 03 Mar 2017, 02:53:06

Wanted to add that renaming the Alias column of the cmsPropertyType table did not resolve the issue for us. The solution was to use the nightly of 7.5.11 linked above by @Sebastiaan.


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.11

Sprint: Sprint 53

Story Points:

Cycle: