Connector Rule - Object reference not set to an instance of an object

MarkBird
Contributor II

Hi 

I always seem to get an "Object reference not set to an instance of an object" in the error log when I execute data loads that use connector rules.

The full error message is:

 

----------------------------------------
Exception Type: Unknown
Message: Object reference not set to an instance of an object.

Stack Trace:
at OneStream.Shared.Engine.XFTelemetryHelper.GetTaskActivityArgsInfo(SessionInfo si, TaskActivityArgs taskActivityArgs) in C:\agent\_work\411\s\Source\Shared\Engine\SharedEngineBase\UserActivity\XFTelemetryHelper.cs:line 55

 

The strange thing is that the data load is always successful... Does anyone know how to get rid of this error message?

Thanks,

Mark

 

 

1 ACCEPTED SOLUTION

Hey Rob

FYI, I reached out to support and they confirmed that it is a bug in the current version of OneStream that we are using (we're on 7.0.1).

"Hi Mark,

I believe this is a bug that has been fixed in version 7.4. It is caused by the Telemetry Service which provides us with logs. This error does not mean anything is breaking, it is just a false flag. Upgrading is the only way to get rid of this error but if possible, would come with extra benefits like access to Smart Integration Connector (SIC), our new connector service. OneStream is moving to Smart Integration Connector (SIC) for all future integrations and will be a requirement for 8.0 so would be good to have the option of slowly migrating.

Thanks, Max"

View solution in original post

13 REPLIES 13

RobbSalzmann
Valued Contributor

Something your code references or returns is null.  That's what the error message means.  If you post the code you're running maybe we can help you find the bug.

 

Hi Rob

I have tried the following two scripts:

api.Parser.ProcessSQLQuery(si, DbProviderType.OLEDB, connectionName, True , sSQL, False, api.ProcessInfo)
'Get data from source.
Using dbC As DbConnInfo = BRApi.Database.CreateExternalDbConnInfo(si, connectionName)
	dt = BRApi.Database.ExecuteSql(dbC, sSQL, True)
End Using

'Execute the data load
api.Parser.ProcessDataTable(si, dt, False, api.ProcessInfo)

Both work, but both seem to produce the same message in the error log (on a side note, do you know which is the best one to use from a performance point of view?)

 

This is a fragment, it leaves out most possibilities to help you.  The problem is likely somewhere in the declarations/assignments, or in your return.

Hi Rob

Below is my main function:

Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As Object
	Try
		Select Case args.ActionType
			Case Is = ConnectorActionTypes.GetFieldList
				'Return Field Name List if using Field List Method to get field list in GetFieldList
				Return Me.GetFieldList(si, globals, api, columnNames)
				
			Case Is = ConnectorActionTypes.GetData
				'Get Data.
				Return Me.GetData(si, api)
				
			Case Is = ConnectorActionTypes.GetDrillBackTypes
				'Return the list of Drill Types (Options) to present to the end user
				Return Me.GetDrillBackTypeList(si, globals, api, args)
				
			Case Is = ConnectorActionTypes.GetDrillBack
				'Process the specific Drill-Back type
				Return Me.GetDrillBack(si, globals, api, args, connectionName, columnNamesDrillBack, accountTypePL, accountTypeBS, accountTypeSignFlip)
			
		End Select
		
		Return Nothing
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Function

 

And Below is the GetData function:

Private Function GetData(ByVal si As SessionInfo, ByVal api As Transformer) As DataTable
	Dim errorlog As String = ""
	Try
		'Set variables.
		Dim wfTime As String = BRApi.Finance.Time.GetNameFromId(si, api.WorkflowUnitPk.TimeKey)
		Dim oTime As TimeMemberSubComponents = BRApi.Finance.Time.GetSubComponentsFromName(si, wfTime)
		Dim wfMonth As Integer = oTime.Month
		Dim wfMonthDesc As String = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}(wfMonth-1)
		Dim wfYear As Integer = oTime.year
		Dim dt As DataTable = Nothing
		
		'Get assigned entities.
		Dim assignedEntitiesWF As List(Of WorkflowProfileEntityInfo) = BRApi.Workflow.Metadata.GetProfileEntities(si, api.WorkflowProfile.ProfileKey)
		Dim assignedEntities As String() = assignedEntitiesWF.Where(Function(m) m.EntityName.StartsWith("D_") = False).Select(Function(m) m.EntityName).ToArray()
		
		'Get SQL query.
		Dim sSQL As String = Me.GetSQL(si, api, wfYear, wfMonth, wfMonthDesc, assignedEntities, accountTypePL, accountTypeBS, accountTypeSignFlip)
		
		'Get data from source.
		Using dbC As DbConnInfo = BRApi.Database.CreateExternalDbConnInfo(si, connectionName)
			dt = BRApi.Database.ExecuteSql(dbC, sSQL, True)
		End Using

		'Execute the data load
		api.Parser.ProcessDataTable(si, dt, False, api.ProcessInfo)

		Return dt
			
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try	
End Function

 

 

RobbSalzmann
Valued Contributor

RobbSalzmann_1-1689772763554.png

Are these declared as instance variables? (declared as part of the class declaration).  If so, consider preceding them with underscores for clarity.   

RobbSalzmann_3-1689773069089.png

 

 

 

 

When I use that function, I get the following error:

MarkBird_0-1689773043987.png

Those are declared as constants

#Region "Constants and Enumerations"

		Dim connectionName As String = "OneStream BI Blend"		
		
		Dim columnNames As String() = {"Account", "AccountType", "Amount", "Credit", "Debit", "Department", "Entity", "Flow", "IC", "Location", "PLCategory", "SourceID", "UD1_ProfitCentre", "UD2_Category", "UD3_Projects", "UD4_DataAudit"}
		
		Dim columnNamesDrillBack As String() = {"Entity", "EntityDesc", "Period", "Account", "AccountDesc", "AccountType", "Debit", "Credit", "Amount", "Debit", "Credit", "Amount", "PLCategory", "Division", "Department", "DepartmentDesc", "Location", "LocationDesc", "PropertyLocation", "PropertyLocationDesc", "ProjectCode", "ProjectCodeDesc"}
		
		Dim accountTypePL As String() = {"COGS", "DeferExpense", "Expense", "Income", "OthExpense", "OthIncome"}
		Dim accountTypeBS As String() = {"AcctPay", "AcctRec", "Bank", "Equity", "FixedAsset", "OthAsset", "OthCurrAsset", "OthCurrLiab", "NonPosting"}
	
		Dim accountTypeSignFlip As String() = {"Income", "OthIncome", "AcctPay", "Equity", "OthCurrLiab"}
		
#End Region

 

Changing it to the following worked though:

MonthName(wfMonth, True)

 

Your original code uses a subscript that subtracts 1 from wfMonth.  Will this yield the correct month now?

Yes, because it was using an wfmonth -1 as the array index.

RobbSalzmann
Valued Contributor

Subscript, "Array Index, all the same thing.

At this point, I would experiment with writing the values of the variables to the log in your Catch block.

This will require you to declare your variables before the try (you should do this anyway). 

I would also chain your exception throwing and only write to the log from Main.  This will give you more of a stacktrace to work with.  

When you say chain your exception throwing, is that not what I'm doing here?

Catch ex As Exception
	Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try

 

I tried a log write in the catch of my Main function and it didn't write anything, so I'll raise a support ticket.

Appreciate your efforts in trying to help me find the issue though!

Mark

Hey Rob

FYI, I reached out to support and they confirmed that it is a bug in the current version of OneStream that we are using (we're on 7.0.1).

"Hi Mark,

I believe this is a bug that has been fixed in version 7.4. It is caused by the Telemetry Service which provides us with logs. This error does not mean anything is breaking, it is just a false flag. Upgrading is the only way to get rid of this error but if possible, would come with extra benefits like access to Smart Integration Connector (SIC), our new connector service. OneStream is moving to Smart Integration Connector (SIC) for all future integrations and will be a requirement for 8.0 so would be good to have the option of slowly migrating.

Thanks, Max"