SparkDevNetwork/Rock

Connection Opportunity Field Type breaks in Page Parameter Filter

Closed this issue · 0 comments

Description

When selecting a Connection Opportunity in a Page Parameter Filter, the page gets a Null Reference Exception rather than actually filtering/selecting the Connection Opportunity.
Screenshot 2024-08-26 at 4 35 45 PM
Screenshot 2024-08-26 at 4 37 25 PM

NullReferenceException in Rock

Message
Object reference not set to an instance of an object.
Stack Trace
   at Rock.Field.Types.ConnectionOpportunityFieldType.SetEditValue(Control control, Dictionary`2 configurationValues, String value) in \Rock\Field\Types\ConnectionOpportunityFieldType.cs:line 369
   at RockWeb.Blocks.Reporting.PageParameterFilter.LoadFilters()
   at RockWeb.Blocks.Reporting.PageParameterFilter.OnLoad(EventArgs e)
   at Rock.Web.RockControlAdapter.OnLoad(EventArgs e) in \Rock\Web\RockControlAdapter.cs:line 71
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.<LoadRecursiveAsync>d__246.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 System.Web.Util.WithinCancellableCallbackTaskAwaitable.WithinCancellableCallbackTaskAwaiter.GetResult()
   at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()

I think the error is happening here:

public override void SetEditValue( Control control, Dictionary<string, ConfigurationValue> configurationValues, string value )
{
var editControl = control as ListControl;
if ( editControl != null )
{
var includeInactive = configurationValues.ContainsKey( INCLUDE_INACTIVE_KEY ) && configurationValues[INCLUDE_INACTIVE_KEY].Value.AsBoolean();

This file is changed in the most recent version in the "develop" branch, so maybe it will be fixed after 16.6. This issue occurs in our site (16.6) and in the demo site (16.6)

Actual Behavior

The page crashes with an exception when filtering on any Connection Opportunity.

Expected Behavior

The page successfully filters using the Connection Opportunity selected.

Steps to Reproduce

  • Create a Page Parameter Filter block
  • Add a Connection Opportunity Field Type to the block (no modifications needed)
  • Select a Connection Opportunity to filter
  • Click "Filter"
  • See Exception

Issue Confirmation

  • Perform a search on the Github Issues to see if your bug or enhancement is already reported.
  • Reproduced the problem on a fresh install or on the demo site.

Rock Version

16.6

Client Culture Setting

en-us