Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting CS1061 error on compile even though the property exists
    primarykey
    data
    text
    <p>I have come across the most curious problem ever as .Net dev. I am compiling a library which has a newly added property <em>DeviceID</em> in the class of <em>UserInfo</em>. The library internally uses the type and it's new property just fine, but when I try and reference it from another library, the compiler kicks back a compiler error stating </p> <pre><code>'library.UserInfo' does not contain a definition for 'DeviceID' and no extension method 'DeviceID' accepting a first argument of type 'library.UserInfo' could be found </code></pre> <p>Even though my class definition looks like:</p> <pre><code>public class UserInfo { public static UserInfo Current { get { if (UserInfoPrincipal.Current != null) { return UserInfoPrincipal.Current.UserData; } else { return null; } } } public string UserID { get; set; } public string DeviceID { get; set; } public string MikeLiUserID { get; set; } public string TransactionServer { get; set; } public string ApplicationKey { get; set; } public string IpAddress { get; set; } } </code></pre> <p>The offending code reads as such:</p> <pre><code> internal LogDetail BuildLogDetail(LogType entryType, string message) { return new LogDetail { ActingUserID = UserInfo.Current.UserID, ActingDeviceID = UserInfo.Current.DeviceID, ApplicationKey = UserInfo.Current.ApplicationKey, IpAddress = UserInfo.Current.IpAddress, EntryType = entryType, OwnerID = UserInfo.Current.UserID, LogData = message }; } </code></pre> <p>I'd like to note that all of the other members of the UserInfo class go through the compiler correctly and it is just the DeviceID, which was added today, is causing the issue. I've tried Clean All, I've tried refreshing everything from TFS, manually deleting the obj and bin directories of both projects... nothing yet has worked.</p> <p><strong>UPDATE</strong>: This code, which is part of the library, works correctly:</p> <pre><code>public class UserInfoPrincipal : IPrincipal { public static UserInfoPrincipal Current { get { if (Thread.CurrentPrincipal is UserInfoPrincipal) return (UserInfoPrincipal)Thread.CurrentPrincipal; else return null; } } ... internal UserInfo UserData { get { return _userInfo; } } public string DeviceID { get { return _userInfo.DeviceID; } } ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload