B
Bill Smith
I've been using System.Diagnostic.EventLog & EventLogEntries for over a year
and I still do not understand some aspects of how they are supposed to work.
Here is one particular issue I have never made sense of:
The EventLogEntries is the framework's only mechanism to fetch event logs.
This can be done by fetching by index within this special collection class.
This all seems simple and straightforward with one exception: the bounds and
contents of this collection appear to change dynamically during the lifetime
of this object. For example, I can fetch the Security log for a remote
target and see in the EventLogEntries object that this log has 1000 entries
that begin with record # 653617 and end with record # 653716. But while
iterating the collection, I can find that suddenly the object has 980
entries and all entries have moved underneath me (e.g. record # 653716 was
at index 999 and is now at index 979).
I realize the underlying cause is that the event logs on the remote target
are being pruned based on their configuration (e.g. based on the maximum log
size). However, it is undecipherable to me how anyone could be expected to
work a collection of entries whose contract with the caller appears to be
that its size and contents can change at any time, for any reason and
without any event notification.
If someone can help me make sense of this, it would be appreciated.
and I still do not understand some aspects of how they are supposed to work.
Here is one particular issue I have never made sense of:
The EventLogEntries is the framework's only mechanism to fetch event logs.
This can be done by fetching by index within this special collection class.
This all seems simple and straightforward with one exception: the bounds and
contents of this collection appear to change dynamically during the lifetime
of this object. For example, I can fetch the Security log for a remote
target and see in the EventLogEntries object that this log has 1000 entries
that begin with record # 653617 and end with record # 653716. But while
iterating the collection, I can find that suddenly the object has 980
entries and all entries have moved underneath me (e.g. record # 653716 was
at index 999 and is now at index 979).
I realize the underlying cause is that the event logs on the remote target
are being pruned based on their configuration (e.g. based on the maximum log
size). However, it is undecipherable to me how anyone could be expected to
work a collection of entries whose contract with the caller appears to be
that its size and contents can change at any time, for any reason and
without any event notification.
If someone can help me make sense of this, it would be appreciated.