Using IntelliTrace, I'm unable to see the output of a string passed by reference into a method and the result of the method in the same event (or at all).
Method example:
public bool ByReferenceTestMethod(System.ArgumentNullException exception, ref string referenceArgument)
{
referenceArgument = string.Format("referenceArgument{0}", exception.Message);
return true;
}
collectionplan.xml example working without reference argument reference:
<DiagnosticEventSpecification>
<CategoryId>stackoverflow.test.application</CategoryId>
<SettingsName _locID="settingsName.Test.Application.Reference">VerifyIDFromBackEnd called</SettingsName>
<SettingsDescription _locID="settingsDescription.Test.Application.Reference">VerifyIDFromBackEnd was called</SettingsDescription>
<Bindings>
<Binding onReturn="false">
<ModuleSpecificationId>stackoverflow.test.application</ModuleSpecificationId>
<MethodName>ByReferenceTestMethod</MethodName>
<MethodId>Test.Application.TestClass.ByReferenceTestMethod(System.ArgumentException,System.String&):System.Boolean</MethodId>
<ShortDescription _locID="shortDescription.Test.Application.Reference.called">Method 'ByReferenceTestMethod' called</ShortDescription>
<LongDescription _locID="longDescription.Test.Application.Reference.called">ByReferenceTestMethod called with ArgumentException parameter name "{0}" and message "{1}"</LongDescription>
<TypeName>Test.Application.TestClass</TypeName>
<DataQueries>
<DataQuery index="1" maxSize="2048" type="String" name="Exception parameter" _locID="dataquery.Test.Application.Reference.exception.Paramname" query="m_paramName" />
<DataQuery index="1" maxSize="2048" type="String" name="Exception message" _locID="dataquery.Test.Application.Reference.exc5eption.Message" _locAttrData="name" query="_message" />
</DataQueries>
</Binding>
<Binding onReturn="true">
<ModuleSpecificationId>stackoverflow.test.application</ModuleSpecificationId>
<MethodName>ByReferenceTestMethod</MethodName>
<MethodId>Test.Application.TestClass.ByReferenceTestMethod(System.Exception,System.String&):System.Boolean</MethodId>
<ShortDescription _locID="shortDescription.Test.Application.Reference.result">Method 'ByReferenceTestMethod' completed</ShortDescription>
<LongDescription _locID="longDescription.Test.Application.Reference.result">ByReferenceTestMethod returned result "{0}" with an unknown referenceArgument</LongDescription>
<TypeName>Test.Application.TestClass</TypeName>
<DataQueries>
<DataQuery index="-1" maxSize="0" type="Boolean" name="Reference Result" _locID="dataquery.Test.Application.Reference.result" _locAttrData="name" query="" />
</DataQueries>
</Binding>
</Bindings>
</DiagnosticEventSpecification>
collectionplan.xml example not working with reference argument reference:
<LongDescription _locID="longDescription.Test.Application.Reference.result">ByReferenceTestMethod returned result "{0}" with referenceArgument "{1}"</LongDescription>
<TypeName>Test.Application.TestClass</TypeName>
<DataQueries>
<DataQuery index="-1" maxSize="0" type="Boolean" name="Reference Result" _locID="dataquery.Test.Application.Reference.result" _locAttrData="name" query="" />
<DataQuery index="2" maxSize="4096" type="String" name="referenceArgument" _locID="dataquery.Test.Application.Reference.Reference.Value" _locAttrData="name" query="" />
</DataQueries>
This shows the LongDescription without the resolved markers and if I change the order the message itself doesn't appear at all.
From what I understand, the ref should appear when onResult="true" because that event isn't evaluated until after the method returns. If I use place the same argument in the onResult="false" dataquery then it is evaluated before the value is possibly set by the method.
What am I doing wrong?