J
John Lee
Hi, All,
I have an issue really need help on, Thanks in advance!!!
OS: windows xp
..NET framework v1.1
Enterprise Instrumentation Framework installed
I did the following customization in the event schema project:
Modified the CommonEvent class:
1. added property String ContextKey
2. added property MyExtraInfo ExtraInfo
The MyExtraInfo class:
using System;
using System.Collections.Specialized;
using System.Runtime.Serialization ;
using Microsoft.EnterpriseInstrumentation.Schema;
[Serializable]
[InstrumentationType]
public class MyExtraInfo : ISerializable
{
private NameValueCollection data;
public CLCExtraInfo()
{
data = new NameValueCollection();
}
public CLCExtraInfo(SerializationInfo info,StreamingContext context)
{
data = new NameValueCollection();
System.Runtime.Serialization.SerializationInfoEnumerator enumerator
= info.GetEnumerator();
while (enumerator.MoveNext())
{
data.Add(enumerator.Current.Name,
enumerator.Current.Value.ToString());
}
}
public void Add(string keyName, string keyValue)
{
data.Add(keyName, keyValue);
}
void ISerializable.GetObjectData(SerializationInfo info,
StreamingContext context)
{
if (data.Count == 0) return;
foreach (string key in data.AllKeys)
{
info.AddValue(key, data[key]);
}
}
}
When I raise event with ContextKey and ExtraInfo (added bunch of name-value
pairs) set, from the eventlog, I see the ContextKey has been serialized
correctly
but the ExtraInfo which is a type I defined, serialized as
MyExtraInfo ExtraInfo = {}
which means nothing insidem, Could anyone point out what could be the
problem?
Thanks very much!
John
I have an issue really need help on, Thanks in advance!!!
OS: windows xp
..NET framework v1.1
Enterprise Instrumentation Framework installed
I did the following customization in the event schema project:
Modified the CommonEvent class:
1. added property String ContextKey
2. added property MyExtraInfo ExtraInfo
The MyExtraInfo class:
using System;
using System.Collections.Specialized;
using System.Runtime.Serialization ;
using Microsoft.EnterpriseInstrumentation.Schema;
[Serializable]
[InstrumentationType]
public class MyExtraInfo : ISerializable
{
private NameValueCollection data;
public CLCExtraInfo()
{
data = new NameValueCollection();
}
public CLCExtraInfo(SerializationInfo info,StreamingContext context)
{
data = new NameValueCollection();
System.Runtime.Serialization.SerializationInfoEnumerator enumerator
= info.GetEnumerator();
while (enumerator.MoveNext())
{
data.Add(enumerator.Current.Name,
enumerator.Current.Value.ToString());
}
}
public void Add(string keyName, string keyValue)
{
data.Add(keyName, keyValue);
}
void ISerializable.GetObjectData(SerializationInfo info,
StreamingContext context)
{
if (data.Count == 0) return;
foreach (string key in data.AllKeys)
{
info.AddValue(key, data[key]);
}
}
}
When I raise event with ContextKey and ExtraInfo (added bunch of name-value
pairs) set, from the eventlog, I see the ContextKey has been serialized
correctly
but the ExtraInfo which is a type I defined, serialized as
MyExtraInfo ExtraInfo = {}
which means nothing insidem, Could anyone point out what could be the
problem?
Thanks very much!
John