Interesting Problem

  • Msg 6522, Level 16, State 1, Procedure StagingDataPromoteBatch, Line 0

    A .NET Framework error occurred during execution of user-defined routine or aggregate "StagingDataPromoteBatch":

    System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.

    The protected resources (only available with full trust) were: All

    The demanded resources were: Synchronization

    System.Security.HostProtectionException:

    at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)

    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

    at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData)

    at System.Diagnostics.TypedElement.BaseGetRuntimeObject()

    at System.Diagnostics.ListenerElement.GetRuntimeObject()

    at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()

    at System.Diagnostics.TraceInternal.get_Listeners()

    at System.Diagnostics.TraceInternal.WriteLine(String message)

    at System.Diagnostics.Debug.WriteLine(String message)

    at StoredProcedures.StagingDataPromoteBatch(SqlInt32 vendorId, SqlInt32 templateId)

    .

    I am getting the above error when executing the "StagingDataPromoteBatch", but this does not throw an error every single time, only sometimes? Meaning, I have to pass in two parameters to the stored procedure which will get all the metadata for those two parameters, and promote data. It works for most of the parameters, but I get this error on some of the parameters. I do not believe it is a permission issue, because I believe if it was, it would throw that error every single time when the stored procedure is ran.

    Let me know what your thoughts are.

    Thanks.

  • Figured out the problem. It seems as though, this error is thrown whenever there is something wrong with the insert statement or any sql statement that we are trying to execute.

    In this case, I was trying to cast a nvarchar value. Another time, the column name was wrong, so all these different errors threw the same .net error, hard to debug and try to figure out what is wrong.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply