Null Reference Exception - ProcessFilePropertiesMacros()

Dec 7, 2011 at 12:36 AM
Edited Dec 7, 2011 at 9:09 PM

Ok, so I was getting a null reference exception when I was using this on a FILE send port bound to an orchestration.  After a quick debug, I found out why:

The ProcessFilePropertiesMacros() method is called when the transport type is FILE, but the method's logic must assume that this is used in a FILE receive location or a FILE send port that is directly bound to a FILE receive because it assumes that there is a value for the ReceivedFileName Context Property.  When I use this in a FILE send port bound to an orchestration sending a message that was constructed within the orchestration, there is no ReceivedFileName unless I explicitly specify the value of the context property in the orchestration.  My reccommendation is to add a small bit of code to test whether the ReceivedFileName == null and if so then replace it with something like the MessageID or something...

Event Type: Warning
Event Source: SABArchiving
Event Category: None
Event ID: 0
Date:  12/6/2011
Time:  5:11:04 PM
User:  N/A
Object reference not set to an instance of an object.
   at SAB.BizTalk.Pipelines.Components.Archiving.SABArchiving.ProcessFilePropertiesMacros(String Target, IBaseMessage Message)
   at SAB.BizTalk.Pipelines.Components.Archiving.SABArchiving.Execute(IPipelineContext pc, IBaseMessage inmsg)