I am also getting this error message. I have created my own dynamic security stored procedure based upon your sample code and I am getting the same error on the line where the expressionText property is set. I thought that maybe it was my code, so I pulled your solution from the SQL Mag article. When I run the sample code through the debugger I am getting the same error message at the expressiontext line. I have provided the error message that I am getting below and have italized the code which is throwing the error. I of course know this works, but I have no idea what I am doing wrong and how to fix it. Do you have any ideas? Thanks for any help that you can give me.
While reader.Read()expr.ExpressionText = String.Format("[Reseller].[Reseller Name].&[{0}]", reader(0).ToString())
' Get the member
Dim member As Member = expr.CalculateMdxObject(Nothing).ToMember()
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="msmgdsrv"
StackTrace:
at PFSetLastError(Int32 , PF_External , UInt16* , UInt16* , UInt64 )
at PFSetLastError(Int32 in_hrError, UInt16* in_szNote, UInt16* in_szTag, UInt64 in_mskState)
at Microsoft.AnalysisServices.AdomdServer.g_GetMDContext()
at Microsoft.AnalysisServices.AdomdServer.Expression.set_ExpressionText(String expressionText)
at UDM.Prologika.Extensibility.Security.GetSecurityFilter(String userName) in C:\Documents and Settings\leof\Desktop\Source\Source\Extensibility\Security.vb:line 83
at ConsoleApplication1.Module1.Main() in C:\Documents and Settings\leof\Desktop\Source\Source\ConsoleApplication1\Module1.vb:line 11
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[ args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[ args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()