SQL CLR errors after the July 2020 update RRS feed

  • Question

  • I have a large system that uses a SQL CLR component to contact a server and get XML back. It's been rock-solid until the latest update. Now instead of getting XML in it throws an error: The type initializer for 'Scope' threw an exception. If I remove the update, it works normally. Any clue what in that big roll-up might have broken SQL CLR using WebClient to get XML?

    Here is a snippet from a test program that basically is the same as the really large module:

        Dim values As New NameValueCollection
        Dim enc As Encoding = New UTF8Encoding(True, True)
        values.Add("Username", "xxx")
        values.Add("Password", "yyy")
        values.Add("App", "test")
        values.Add("InputData", Uri.EscapeDataString(strInputData))
        Dim strResponse As String = ""
        Dim strURL As String = server & "/service/amps_price.aspx"
        Using client As New WebClient()
        Dim responseBytes As Byte() = client.UploadValues(strURL, values)
        strResponse = (New System.Text.UTF8Encoding(False)).GetString(responseBytes)
        End Using
        Dim xmlResponse As New XmlDocument()
        Dim blnValidResponse As Boolean
        blnValidResponse = Integer.TryParse(xmlResponse.SelectSingleNode("Amps/ReturnCode").InnerText, intAmpsReturnCode)
        strAmpsReturnDesc = xmlResponse.SelectSingleNode("Amps/ReturnDesc").InnerText
        If (blnValidResponse) Then
        strApcPricerResults = strResponse
        End If
        intAmpsReturnCode = -99
        strAmpsReturnDesc = "ERROR"
    Catch ex As WebException
        intAmpsReturnCode = ex.Status
        strAmpsReturnDesc = ex.Message
    End Try

    Stack Trace:

    The type initializer for 'Scope' threw an exception. -

    at System.Data.TypeLimiter.Scope.IsTypeUnconditionallyAllowed(Type type) at System.Data.TypeLimiter.Scope.IsAllowedType(Type type) at System.Data.TypeLimiter.EnsureTypeIsAllowed(Type type, TypeLimiter capturedLimiter) at System.Data.DataColumn.UpdateColumnType(Type type, StorageType typeCode) at System.Data.DataColumn..ctor(String columnName, Type dataType, String expr, MappingType type) at System.Data.XSDSchema.HandleElementColumn(XmlSchemaElement elem, DataTable table, Boolean isBase) at System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase) at System.Data.XSDSchema.HandleComplexType(XmlSchemaComplexType ct, DataTable table, ArrayList tableChildren, Boolean isNillable) at System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef) at System.Data.XSDSchema.HandleTable(XmlSchemaElement node) at System.Data.XSDSchema.LoadSchema(XmlSchemaSet schemaSet, DataSet ds) at System.Data.DataSet.InferSchema(XmlDocument xdoc, String[] excludedNamespaces, XmlReadMode mode) at System.Data.DataSet.ReadXml(XmlReader reader, XmlReadMode mode, Boolean denyResolving) at Amps.Pcm.clsOutptData.UpdateApc(SqlConnection conn, Int32 intClaimId, Decimal decPaymentPercent, String xmlResults) at Amps.Pcm.StoredProcedures.usp_adj_clr_api_outpatient_price(SqlInt32 claim_id, SqlInt32 contract_id, SqlString vch_server, SqlInt32 int_port)

    Thursday, August 6, 2020 5:49 PM