YAFLogo

tperry
  • tperry
  • 72.2% (Friendly)
  • YAF Lover Topic Starter
12 years ago
Hello again!

Started troubleshooting an issue with emails not being sent on for new private messages after updating to 1.9.6 B1. Thought it was an issue with my email setup, but that is actually configured fine; I can use other email functionality w/o any issues. Stumbled onto this in the Event Log, however:

System.InvalidCastException: Specified cast is not valid.

at System.Data.DataRowExtensions.UnboxT`1.NullableField[TElem](Object value)

at YAF.Types.Objects.TypedUserList..ctor(DataRow row)

at YAF.Classes.Data.LegacyDb.b__19(DataRow x)

at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)

at YAF.Core.Services.YafSendNotification.ToPrivateMessageRecipient(Int32 toUserId, String subject)

Thanks!

Sponsor
bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
12 years ago
tperry
  • tperry
  • 72.2% (Friendly)
  • YAF Lover Topic Starter
12 years ago
Thanks. Just making sure I'm following right; I should run this entire script? All the drops at the beginning are making me a little nervous :-)

EDIT: Nevermind the nonsense I was spouting just now. I found the procedures file in my install/mssql folder and replaced it with the one you provided. I reran the /install/default.aspx but ran into the same issue when i tried to send a PM.

bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
12 years ago
You should simply delete the row in red if it present. I've applied the fix a long time ago but after some unknown merge which can't be traced by the control version a recursion happened, so some fixed things simply could disappear from the beta1 release.
tperry
  • tperry
  • 72.2% (Friendly)
  • YAF Lover Topic Starter
12 years ago
I'll give that a shot, thanks!
tperry
  • tperry
  • 72.2% (Friendly)
  • YAF Lover Topic Starter
12 years ago
Sorry... as far as I can tell, everything on my end is the same as that file. The stored proc on my SQL Server does already have that line removed:

ALTER procedure [dbo].[yaf_user_find](
	@BoardID int,
	@Filter bit,
	@UserName nvarchar(255)=null,
	@Email nvarchar(255)=null,
	@DisplayName nvarchar(255)=null,
	@NotificationType int = null,
	@DailyDigest bit = null
)
AS
begin
	
	if @Filter<>0
	begin
		if @UserName is not null
			set @UserName = '%' + @UserName + '%'
			
		if @DisplayName is not null
			set @DisplayName = '%' + @DisplayName + '%'			

		select 
			a.*,			
			IsAdmin = (select count(1) from [dbo].[yaf_UserGroup] x join [dbo].[yaf_Group] y on y.GroupID=x.GroupID where x.UserID=a.UserID and (y.Flags & 1)<>0)
		from 
			[dbo].[yaf_User] a
		where 
			a.BoardID=@BoardID and
			((@UserName is not null and a.Name like @UserName) or
			(@Email is not null and Email like @Email) or
			(@DisplayName is not null and a.DisplayName like @DisplayName) or
			(@NotificationType is not null and a.NotificationType = @NotificationType) or
			(@DailyDigest is not null and a.DailyDigest = @DailyDigest))
		order by
			a.Name
	end else
	begin
		select 
			a.*,			
			IsAdmin = (select count(1) from [dbo].[yaf_UserGroup] x join [dbo].[yaf_Group] y on y.GroupID=x.GroupID where x.UserID=a.UserID and (y.Flags & 1)<>0)
		from 
			[dbo].[yaf_User] a
		where 
			a.BoardID=@BoardID and
			((@UserName is not null and a.Name like @UserName) or
			(@Email is not null and Email like @Email) or
			(@DisplayName is not null and a.DisplayName like @DisplayName) or
			(@NotificationType is not null and a.NotificationType = @NotificationType) or
			(@DailyDigest is not null and a.DailyDigest = @DailyDigest))
	end
end
bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
12 years ago
Oh, it's another problem. I've misguided you a bit.

I can't reproduce it in the current code, but I can give you a tip how to fix it.

You have user_list sp in scripts. Some field type there is wrong.

So TypedUserList. which takes data from the sp throws an exception.

Check for IsAdmin or IsGuest fields types first

Hopefully it helps.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
12 years ago

I can't reproduce it in the current code, but I can give you a tip how to fix it.

Because its fixed in current code, but i forgot which change set it was.

@tperry

You can only resolve the problem by downloading the Source Code and Recompile it yourself.

http://yafnet.codeplex.com/SourceControl/changeset/view/b9e20bae770b 

tperry
  • tperry
  • 72.2% (Friendly)
  • YAF Lover Topic Starter
12 years ago
Will give that a try, thanks!

Just curious, do you guys have a ball park estimate for 1.9.6 RTM? Hrmmm... ball park may not translate well. Hausnummer, ungefähre Zahl, grobe Schätzung. (I think?? Its been nearly 23 years since I've had to use German regularly.)