none
Excel Power Query Attempted to read or write protected memory error RRS feed

  • Question

  • I have an application using power query to download stock data. When running multiple downloads I randomly receive an Automation error The object invoked has disconnected from its clients. Capturing the info from the frown report it shows Attempted to read or write protected memory error.  Also occurs randomly with single download.  Power Query is called from VBA. Occurs on different Excel version 1902 and 1911 on different machines.

    I have seen references to the issue being corrected with excel version 1902 and above. What is the solution?

    Below is the dump from the frown.

    Help

    Paul Buskey

    Feedback Type:

    Frown (Error)

     

    Error Message:

    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

     

    Stack Trace:

       at Microsoft.Mashup.Client.Excel.NativeExcelFunctionsC2RBase.Microsoft.Mashup.Client.Excel.INativeExcelFunctions.SaveMashupData(IntPtr workbookPointer, String data)

       at Microsoft.Mashup.Client.Excel.Shim.NativeWorkbookStorageServices.SaveMashupData(IWorkbook workbook, MashupCustomXmlPart data)

       at Microsoft.Mashup.Client.Excel.Shim.NativeWorkbookStorageServices.NativeWorkbookStorageDeferrer.Release()

       at Microsoft.Mashup.Client.Excel.Shim.NativeWorkbookStorageServices.Microsoft.Mashup.Client.Excel.Shim.IDeferredStorageInvoker.InvokeDeferredStorageAction(IWorkbook workbook, Action action)

       at Microsoft.Mashup.Client.Excel.Shim.NativeCoAuthServices.InvokeCoauthAction(IWorkbook workbook, UndoableActionType actionType, Action action)

       at Microsoft.Mashup.Client.Excel.Shim.NativeCoAuthServices.InvokeCoauthAction(IWorkbookIdentity workbookIdentity, UndoableActionType actionType, Action action)

       at Microsoft.Mashup.Client.Excel.Fill.FillManager.ForEachFillSessionByWorkbook(Action`1 action)

       at Microsoft.Mashup.Client.Excel.Fill.PassiveFillManager.UpdateQueriesProgress()

       at Microsoft.Mashup.Client.Excel.Fill.PassiveFillManager.<OnFillUpdateTimerTick>b__10_0()

       at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

     

    Stack Trace Message:

    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

     

    Invocation Stack Trace:

       at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()

       at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)

       at Microsoft.Mashup.Client.UI.Shared.FeedbackErrorInfo..ctor(String message, Exception exception, Nullable`1 stackTraceInfo, String messageDetail)

       at Microsoft.Mashup.Client.Excel.Native.NativeUserFeedbackServices.RaiseErrorDialog(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, LocalizedString dialogTitle, LocalizedString dialogMessage, Boolean useGDICapture)

       at Microsoft.Mashup.Client.Excel.Native.NativeUserFeedbackServices.ReportException(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, Boolean useGDICapture)

       at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.<>c__DisplayClass14_0.<HandleException>b__0()

       at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.SendAndMarshalExceptions(SynchronizationContext context, Action callback)

       at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.HandleException(Exception e)

       at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

       at Microsoft.Mashup.Client.Excel.Fill.PassiveFillManager.OnFillUpdateTimerTick(Object sender, EventArgs eventArgs)

       at System.Windows.Forms.Timer.OnTick(EventArgs e)

       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

     

     

    Supports Premium Content:

    False

     

    Formulas:

     

     

    section Section1;

     

    shared #"20yrQuery" = let

        Source = Json.Document(Web.Contents("https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=SPY&outputsize=full&apikey=VOLJHLN7UQ5J9IOL")),

        #"Time Series (Daily)" = Source[#"Time Series (Daily)"],

        #"Converted to Table" = Record.ToTable(#"Time Series (Daily)"),

        #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"1. open", "2. high", "3. low", "4. close", "5. adjusted close", "6. volume", "7. dividend amount", "8. split coefficient"}, {"Value.1. open", "Value.2. high", "Value.3. low", "Value.4. close", "Value.5. adjusted close", "Value.6. volume", "Value.7. dividend amount", "Value.8. split coefficient"}),

        #"Changed Type" = Table.TransformColumnTypes(#"Expanded Value",{{"Name", type date}, {"Value.1. open", Currency.Type}, {"Value.2. high", Currency.Type}, {"Value.3. low", Currency.Type}, {"Value.4. close", Currency.Type}, {"Value.5. adjusted close", Currency.Type}, {"Value.6. volume", Int64.Type}})

    in

        #"Changed Type";

     

    shared #"query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=SPY&outputsize=full&apikey=VOLJ" = let

        Source = Json.Document(Web.Contents("https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=SPY&outputsize=full&apikey=VOLJHLN7UQ5J9IOL")),

        #"Time Series (Daily)" = Source[#"Time Series (Daily)"],

        #"Converted to Table" = Record.ToTable(#"Time Series (Daily)"),

        #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"1. open", "2. high", "3. low", "4. close", "5. adjusted close", "6. volume", "7. dividend amount", "8. split coefficient"}, {"Value.1. open", "Value.2. high", "Value.3. low", "Value.4. close", "Value.5. adjusted close", "Value.6. volume", "Value.7. dividend amount", "Value.8. split coefficient"}),

        #"Changed Type" = Table.TransformColumnTypes(#"Expanded Value",{{"Value.1. open", Currency.Type}, {"Value.2. high", Currency.Type}, {"Value.3. low", Currency.Type}, {"Value.4. close", Currency.Type}, {"Value.5. adjusted close", Currency.Type}, {"Value.6. volume", Int64.Type}, {"Name", type date}})

    in

        #"Changed Type";

     

    shared #"100dQuery2" = let Source = Json.Document(Web.Contents("https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=AXP&outputsize=full&apikey=VOLJHLN7UQ5J9IOL")),

        #"Time Series (Daily)" = Source[#"Time Series (Daily)"],

        #"Converted to Table" = Record.ToTable(#"Time Series (Daily)"),

        #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"1. open", "2. high", "3. low", "4. close", "5. adjusted close", "6. volume", "7. dividend amount", "8. split coefficient"}, {"Value.1. open", "Value.2. high", "Value.3. low", "Value.4. close", "Value.5. adjusted close", "Value.6. volume", "Value.7. dividend amount", "Value.8. split coefficient"}),

        #"Changed Type" = Table.TransformColumnTypes(#"Expanded Value",{{"Value.1. open", Currency.Type}, {"Value.2. high", Currency.Type}, {"Value.3. low", Currency.Type}, {"Value.4. close", Currency.Type}, {"Value.5. adjusted close", Currency.Type}, {"Value.6. volume", Int64.Type}, {"Name", type date}})

    in

        #"Changed Type";

    Saturday, January 4, 2020 7:48 PM

Answers

  • Hi PSBuskey,

    I wasn't able to reproduce this without VBA, can you please provide us with a workbook that reproduces this on your latest Excel version? or provide more details on where the data is loaded to, and what exactly are you doing via VBA?

    Also, in general - Excel's channel of getting feedback is via the "Send a Frown" button in Excel, can you please send your feedback from a session in which it reproduced in? be sure to check "Include diagnostic and usage data" if possible so that we can get required telemetry for investigating the issue.

    Thanks,
    Ron.

    Sunday, January 26, 2020 4:52 PM