I'm designing in VS 2010 with service pack 1 (but had the same error without service pack 1) and installed the NetAdvantage Reporting from NetAdvantage_Ultimate_20121. I'm designing a report for a desktop application. I got all my labels and lines onto the designer and then set my Data Source to an IEnumerable object with a static parameter (also I've tried it with a constant value but still get the error). This all appears to be working correctly and I can see the available fields from the object under my data source. But when I go to drag and drop a field from the data source onto the Body section (or any other section for that matter) of the report, I immediately get an error dialog that says "An unexpected error occurred while dropping an item on the report.". The field (with the = sign in front of it) appears to be on the report but if I try to move it or change the properties, I get the following error in a dialog: "NetAdvantage Reporting has encountered a problem and needs to close. Please save necessary changes and close the Report." Once I click the OK button on this dialog, my Visual Studio application restarts. If I save this field on the report, I can't open the report .igr file without getting the same error and a restart of Visual Studio. I tried downloading the most recent release for NetAdvantage Reporting (NetAdvantage_Reporting_20121.2019_SR) but running it gave me the message that "The version installed is equal to or newer than the patch trying to be installed."
Any ideas of what might be the problem? Thanks for any help.
Hi,
Can you attach a solution where the problem can be reproduced? i.e. the object data source you are using and the igr file with the data source created.
Is this problem only occurring when you define the data source based on a method that receives parameters?
The error with the 2019 installer may be because you already have 2019. The NA ultimate installer may have already installed the last SR for you. You can check if the version of the Reporting dll ends with 2019.
Best,
Leo
Thanks, Leo.
I don't think I can take the time to scale down the solution I'm trying to put this report into. I have verified that the problem stems from the Object DataSource (which I'm sure I want to use since I want to fill the solution from a stored procedure and can't figure out how to do that using a SQL DataSource) as I was able to define a test SQL Data Source and put fields from it on the report form just fine. I'm not at all familiar with using the IEnumerable interface and that is probably the source of my problem.
Here are snippets (very scaled down and genericized for purposes of putting into a public forum) of the code I used to set up the object which I used as the Object DataSource which points to the GetItem function of the ItemRec class:
ItemRec class Public Shared Function GetItem(ByVal intItemID As Integer) As IEnumerable(Of ItemRec) Return ItemDB.GetItemForReport(intItemID) End FunctionItemDB class Public Shared Function GetItemForReport(ByVal intItemID As Integer) As IEnumerable(Of ItemRec) Dim itm As New ItemRec Dim con As SqlConnection = Connection.GetConnection Dim cmd As New SqlCommand("spGetRptItem", con) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@item_id", intItemID) Dim rdr As SqlDataReader con.Open() rdr = cmd.ExecuteReader If rdr.Read Then With itm .ItemDate = rdr.Item("fldItemDate") .ItemNumber = rdr.Item("fldItemNumber") .Description = rdr.Item("fldDescription") .Quantity = rdr.Item("fldQuantity") End With End If rdr.Close() con.Close() Dim items As New List(Of ItemRec) items.Add(itm) Return items End Function
I appreciate any help getting this code functional as it must not be at the moment. But I'm wondering why it caused a fatal error in the Design environment and not some friendlier error.
That makes sense that the installer did install the latest version of the Reporting DLL.
Thanks for your help,
Kurt
This might be another piece to the puzzle. I made the function in my ItemRec class to be IEnumerable but changed the one in my ItemDB class which the calling function returns as just a List(of ItemRec) rather than IEnumerable. I still get the error putting a field from the Object DataSource that I'm pointing to the IEnumerable function in my ItemRec class on the form body. If I don't try to do anything (move it, look at its properties, etc.) to that field, I don't get the restart dialog error. But if I go to the preview of the report, I get the following error (I'm not sure what it means):
nfragistics.Controls.Reports.ReportViewerException: An unknown error occurred while processing the report. ---> System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) at Infragistics.Reports.Expressions.ExternalType.GetProperties() at Infragistics.Reports.Expressions.EvaluationContext.AddDataSource(DataSource dataSource) at Infragistics.Reports.Expressions.EvaluationContextFactory.AddDataSources(IEvaluationContext context, IEnumerable`1 dataSources) at Infragistics.Reports.Expressions.EvaluationContextFactory.GetParseContext(DataParseContext parseContext, ITypeFactory typeFactory, Boolean enableTypeChecking) at Infragistics.Designers.Reports.Validation.BindingValidationProvider.Validate(Binding binding, ReportItem item, Report report) at Infragistics.Designers.Reports.Validation.BindingValidationProvider.Validate(DataObject model, ValidationManager validationManager) at Infragistics.Designers.Reports.ValidationManager.Validate(DataObject model, IValidationCategory validationCategory, HashSet`1 alreadyValidated, Boolean recursive) at Infragistics.Designers.Reports.ValidationManager.Validate(DataObject model, IValidationCategory validationCategory, HashSet`1 alreadyValidated, Boolean recursive) at Infragistics.Designers.Reports.ValidationManager.Validate(DataObject model, IValidationCategory validationCategory, HashSet`1 alreadyValidated, Boolean recursive) at Infragistics.Designers.Reports.ValidationManager.OnTransactionEnded(Object sender, DataTransactionEventArgs e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at Infragistics.Designers.UndoRedoManager.OnTransactionManagerEnded(Object sender, DataTransactionEventArgs e) at Infragistics.Models.Data.Transactions.TransactionManager.NotifyTransactionEnded(DataTransaction transaction) at Infragistics.Models.Data.Transactions.DataTransaction.CommitChanges() at Infragistics.Models.Data.Transactions.TransactionContext.NotifySetPropertyValue[T](DataObject obj, DataProperty property, T oldValue, T newValue) at Infragistics.Models.Data.Transactions.AttachingContext.NotifySetPropertyValue[T](DataObject obj, DataProperty property, T oldValue, T newValue) at Infragistics.Models.Data.DataObjectImpl.NotifyValueSet[T](DataObject obj, DataProperty property, T oldValue, T newValue, Action`2 propertyChanged) at Infragistics.Models.Data.DataObject.SetValueInternal(DataProperty property, Object value) at Infragistics.Models.Data.DataObject.InvokeSetValue(DataProperty property, Object value) at Infragistics.Models.Data.DataId.GenerateUuid(DataObject obj, Boolean& newId) at Infragistics.Controls.Reports.PreviewRenderingEngineFactory.CalculateReportDefinitionGuids(DataObjectVisitor visitor, DataObject reportDefChildren) at Infragistics.Models.Data.Visitors.DataObjectVisitor.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.VisitorWriter.WriteDataObject(DataProperty property, DataObject obj) at Infragistics.Reports.DataSource.WriteValues(IDataPropertyWriter writer) at Infragistics.Reports.ObjectDataSource.WriteValues(IDataPropertyWriter writer) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitor.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.VisitDataCollection(DataProperty property, IDataCollection collection) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitor.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.VisitorWriter.WriteDataObject(DataProperty property, DataObject obj) at Infragistics.Reports.Report.WriteValues(IDataPropertyWriter writer) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitor.VisitDataObject(DataProperty property, DataObject obj) at Infragistics.Models.Data.Visitors.DataObjectVisitorBase.Visit(DataObject obj) at Infragistics.Controls.Reports.PreviewRenderingEngineFactory.GenerateReportDefinitionGuids(Report reportDefinition) at Infragistics.Controls.Reports.PreviewRenderingEngineFactory.CreateLocalEngine(ReportSource reportSource, Assembly reportAssembly, IEnumerable`1 dataSources) at Infragistics.Controls.Reports.ProcessingSessionStateMachine.CreateProcessor(IRenderingEngineFactory renderingEngineFactory, IEnumerable`1 externalDataSources, Report reportDefinition, Assembly reportAssembly) --- End of inner exception stack trace --- at Infragistics.Controls.Reports.ProcessingSessionStateMachine.CreateProcessor(IRenderingEngineFactory renderingEngineFactory, IEnumerable`1 externalDataSources, Report reportDefinition, Assembly reportAssembly) at Infragistics.Controls.Reports.ViewerStateMachine.RenderHelper(RenderParameters renderParameters, Report reportDefinition, Assembly reportAssembly)
Thanks for any help.
OK, I finally figured out the problem. Taking a hint after looking up the error "An item with the same key has already been added.", I saw that in the class ItemRec, which I am returning as an object in the list, there were two properties named "Items" both of which had two parameters that differed so basically one property was an overload of the other. But the report evidently doesn't like two fields under the Data Source to have the same name. I renamed one of these properties and now I am having no more problems. I suppose I should have made a special class for this report to be the object returned and might still do that.
Hopefully this may help someone else who runs across this same type of problem.
Thanks again to the Leo for the offer of help.