cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
PowerDAX
Resolver III
Resolver III

Direct Query - Collection was modified; enumeration operation may not execute

Continuously run into this error with a data model built using Direct Query to a SQL on-premises database.  This occurs after saving pbix file and opening the next day.  I have had to try converting to zip and replacing the guts of a blank pbix with that of the "broken" direct query pbix but was unsuccessful with the last two.  I am now having to restore a backup from onedrive and lose any changes made since.

 

Full error message:

 

Feedback Type:
Frown (Error)

Error Message:
Collection was modified; enumeration operation may not execute.

Stack Trace:
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at Microsoft.Mashup.Host.Document.FormulaRegistry.<GetBuiltInFormulas>d__0.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Microsoft.Mashup.Host.Document.FormulaSet.FilteredFormulaSet.<GetFormulas>d__8.MoveNext()
at Microsoft.Mashup.Host.Document.FormulaRegistry.<GetPotentialFormulasCore>d__11.MoveNext()
at Microsoft.Mashup.Host.Document.FormulaRegistry.<GetPotentialFormulas>d__b.MoveNext()
at Microsoft.Mashup.Host.Document.FormulaRegistry.TryGetFormula(FormulaSet formulaSet, FormulaReference formulaReference, FormulaResult baseResult, Formula& formula)
at Microsoft.Mashup.Host.Document.FormulaRegistry.GetFormula(FormulaSet formulaSet, FormulaReference formulaReference, FormulaResult baseResult)
at Microsoft.Mashup.Client.UI.Shared.QueryExtensions.<>c__DisplayClass14.<SupportsCubeDirectQuery>b__13(PackageEditor packageEditor)
at Microsoft.Mashup.Host.Document.Model.Queries.InvokeWithPackageEditor[T](Nullable`1 changeReason, Func`2 action)
at Microsoft.Mashup.Client.UI.Shared.QueryExtensions.SupportsCubeDirectQuery(Query query)
at Microsoft.Mashup.Client.UI.Shared.QueryExtensions.IsCubeDirectQuery(Query query)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.PowerBI.Client.Windows.Report.UpdateCurrentDataProviderCapabilities()
at Microsoft.PowerBI.Client.Windows.Report..ctor(PackagePath packagePath, String reportViewDocumentContent, ReportVersionCompatibilityFlags versionCompatibility, ConnectionsSettings connectionSettings, CustomVisualCollection customVisuals, String diagramViewState, ReportLinguisticSchema linguisticSchema, ReportMetadata metadata, ReportSettings reportSettings, StaticResourceCollection staticResources)
at Microsoft.PowerBI.Client.Windows.Services.ReportFactory.CreateReportFromPowerBIPackage(IPowerBIPackage powerBIPackage, String pbixFilePath, Byte[] securityBindings, Boolean requiresConversionToReportLayout, PowerBIPackageOpenOptions options, IPowerBITelemetryService powerBITelemetryService, IAnalysisServicesService analysisServices, PackageValidationResult& mashupValidationResult)
at Microsoft.PowerBI.Client.Windows.Services.PowerBIPackagingService.Open(FileStream fileStream, IPowerBIWindowService windowService, Nullable`1 entryPoint, PowerBIPackageOpenOptions options, Boolean& allCredentialsSatisfied)
at Microsoft.PowerBI.Client.Windows.Services.FileManager.<LoadFromPbix>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.<>c__DisplayClassa`1.<<BlockUIAndRun>b__9>d__c.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.WaitOnUIThreadForTaskCompletion(Task task)
at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.BlockUIAndRun[T](Func`1 asyncMethod)
at Microsoft.PowerBI.Client.Windows.Services.FileManager.OpenFile(IPowerBIWindowService windowService, IPbixFile fileToOpen, Nullable`1 entryPoint)
at Microsoft.PowerBI.Client.Program.TryOpenOrCreateReport(IUIHost uiHost, ISplashScreen splashScreen, IFileManager fileManager, IFileHistoryManager fileHistoryManager, String filePath, FileType fileType)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClassb.<Main>b__0()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass7.<HandleExceptionsWithNestedTasks>b__6()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

Stack Trace Message:
Collection was modified; enumeration operation may not execute.

Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.FeedbackErrorInfo..ctor(String message, Exception exception)
at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.ReportException(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, Boolean useGDICapture)
at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.<>c__DisplayClass1.<HandleException>b__0()
at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.HandleException(Exception e)
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.Main(String[] args)

powerdax.com
1 REPLY 1
v-jiascu-msft
Microsoft
Microsoft

Hi @PowerDAX,

 

To be honest, I would suggest you file a support ticket here for such errors. But you still can try to upgrade the Desktop first.

create ATicket

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors