SparkDevNetwork / Rock

An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
http://www.rockrms.com
580 stars 353 forks source link

Connection Opportunity Field Type breaks in Page Parameter Filter #5991

Closed ghost closed 2 months ago

ghost commented 2 months ago

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: https://github.com/SparkDevNetwork/Rock/blob/504f4382e736d1d8629bf3b6d8fcd786e0c9dbaa/Rock/Field/Types/ConnectionOpportunityFieldType.cs#L366-L371

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

Issue Confirmation

Rock Version

16.6

Client Culture Setting

en-us