Error when removing field from view used as graph source (v2.0 beta 2)

May 29, 2009 at 2:45 PM

Great WebPart!

I have found a little "bug" witch  appears when a field in av view used as graph source is removed from the view (used as y-source in the graph).
If you display the page with the graph, this error is displayed:

An exception occurred:System.ArgumentException: Value does not fall within the expected range. at Microsoft.SharePoint.SPFieldMap.GetColumnNumber(String strFieldName) at Microsoft.SharePoint.SPListItemCollection.GetRawValue(String fieldname, Int32 iIndex) at Microsoft.SharePoint.SPListItem.GetValue(SPField fld, Int32 columnNumber, Boolean bRaw) at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException) at Microsoft.SharePoint.SPListItem.GetValue(String strName) at Microsoft.SharePoint.SPListItem.get_Item(String fieldName) at ChartPart.ChartPartWebPart.GenerateChart() at ChartPart.ChartPartWebPart.Render(HtmlTextWriter writer)

It's nothing wrong in this error - the field is no loger available to the graph so it's as expected. The bug appears when i try to edit the webpart properties to select another field to graph on. When i click "Edit shared WebPart" i get this error  dnd cannot edit the webpart. the only way out is to delete the webpart:

 Server Error in '/' Application.

Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
  ChartPart.ChartPartEditorPart.SyncChanges() +2954
  Microsoft.SharePoint.WebPartPages.ToolPane.OnSelectedWebPartChanged(Object sender, WebPartEventArgs e) +193
  System.Web.UI.WebControls.WebParts.WebPartEventHandler.Invoke(Object sender, WebPartEventArgs e) +0
  Microsoft.SharePoint.WebPartPages.SPWebPartManager.BeginWebPartEditing(WebPart webPart) +200
  Microsoft.SharePoint.WebPartPages.SPWebPartManager.ShowToolPaneIfNecessary() +515
  Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnPageInitComplete(Object sender, EventArgs e) +702
  System.EventHandler.Invoke(Object sender, EventArgs e) +0
  System.Web.UI.Page.OnInitComplete(EventArgs e) +11035597
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1673