Having looked more closely at the SQL script that is run by GrantUserDefinedFunctionsPermissions() I think I can see what the problem is.
The script first runs:
select * from dbo.sysobjects o where ( OBJECTPROPERTY(o.id, N'IsProcedure') = 1 or OBJECTPROPERTY(o.id, N'IsExtendedProc') = 1 or OBJECTPROPERTY(o.id, N'IsReplProc') = 1 ) and OBJECTPROPERTY(o.id, N'IsMSShipped') = 0 and o.name not like N'#%%' and (left(o.name,len('')) = '' or left(o.name,7) = 'aspnet_')
This returns all the stored procedure names but without the database owner appended. So for example it returns "AddSearchItem" which is actually called "dbo169059670.AddSearchItem" in the database. I actually ran the above SQL on my DNN to check.
It then runs:
grant EXECUTE on AddSearchItem to [dbo169059670]
but this will always fail unless you append the database owner, so it should be:
grant EXECUTE on dbo169059670.AddSearchItem to [dbo169059670]
which when I check runs happily. Also pointed out in another bug it should be:
grant EXECUTE on [dbo169059670].[AddSearchItem] to [dbo169059670]
There are other errors in the log but these can be fixed by manually changing the permsions which is what this function should do. When I run all the upgrade scripts manually and apply the permissions it seems to work.
Can this be fixed please it is a pain to install all the scripts manually.