11

At some point in the last couple of months, a lot of message along the lines of

Event 7 was called with 5 argument(s) , but it is defined with 6 paramenter(s).
Event 10 was called with 5 argument(s) , but it is defined with 6 paramenter(s).
Event 10 was called with 5 argument(s) , but it is defined with 6 paramenter(s).

started spamming my Visual Studio output window making it hard to find actual trace and debug messages. Where are these messages coming from, and how do I disable them?

To try to solve this problem, I have tried several things.

  • Most of the answers point to configuring the checkboxes in the output window. If I uncheck "Program Output" the problem messages go away, but so do the messages I want to keep.
  • I tried creating a custom TraceListener and set a breakpoint in the Write and WriteLine methods in the hopes that the call stack would tell me where the messages were being generated from. I discovered that these messages are not coming from the typical Diagnotics.Debug or Diagnotics.Trace methods.
  • I tried redirecting the console via Console.SetOut() to a custom TextWriter that I could set breakpoints within. Again, I could not find anything.

Any help would be appreciated.

Community
  • 1
  • 1
erdomke
  • 4,980
  • 1
  • 24
  • 30
  • For which projects? [Stackify](http://stackoverflow.com/q/42123222/1997232) ? [Azure](https://social.msdn.microsoft.com/Forums/vstudio/en-US/f99be030-a2d9-4013-92f9-075bff0b318a/debugger-output-says-an-event-was-called-with-wrong-number-of-arguments-cant-find-source?forum=vsdebug) ? [Rebus](https://github.com/rebus-org/Rebus/issues/566) ? – Sinatr Mar 15 '17 at 16:01
  • I am using Stackify Prefix. Good catch on that one. I'm not sure how my searching didn't find it. If you wrap that up as an answer, I will mark it as accepted. Thanks! – erdomke Mar 16 '17 at 12:45
  • You can just delete the question. The answer "It's not you, it's `Stackify`" is unlikely to be useful to others. It's very likely they will find that question too. – Sinatr Mar 16 '17 at 12:49
  • For my own knowledge, what search did you use to find the question? Variations of "Event 7 was called with 5 argument(s) , but it is defined with 6 parameters)" in Google or "Visual Studio output window" didn't get me to that result in the first few pages. – erdomke Mar 16 '17 at 15:40
  • 1
    @erdomke Did you find where this was coming from and/or how to fix it? – Joshjje Mar 17 '17 at 17:05

2 Answers2

9

As @Sinatr helpfully mentioned in his comment, this can be caused by several different system configurations which I did not find information on during my initial search. In particular, more information can be found at the following links:

In my situation, the culprit appears to be the combination of Application Insights and Stackify Prefix as documented in the StackOverflow question linked above.

Community
  • 1
  • 1
erdomke
  • 4,980
  • 1
  • 24
  • 30
5

Ive found the assembly this string is coming from, but not yet how or where.

It is found in mscorlib.dll line 54673 in the raw dll (32 bit version): Event {0} was called with {1} argument(s) , but it is defined with {2} paramenter(s)

Its from the resource name value pairs, this one is named EventSource_EventParametersMismatch

This is being used from system\diagnostics\eventing\eventsource.cs WriteToAllListeners https://referencesource.microsoft.com/#mscorlib/system/diagnostics/eventing/eventsource.cs,7c04b58f26d81951

Joshjje
  • 220
  • 4
  • 14