Question

I have a C# solution containing Postsharp v3, Resharper 8, Redgate SqlBundle and .Net toolbet + some very large T4 template generated code.

When generating code from templates and attempting to open them up a folder on my hard disk ..\AppData\Local\Red Gate\Logs\SQL Connect 1* fills up with 50 MB log files every 4 or 5 seconds. All with very similar content.

14:49:01.331|Trace  |g.TraceLoggerAdapter|1  |#1:devenv.exe Information: 0 :  at    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at RedGate.SQLConnect.VsPackage.Logging.TraceLoggerAdapter.WriteLine(String message)
   at RedGate.SQLConnect.VsPackage.Logging.TraceLoggerAdapter.Write(String message)
   at System.Diagnostics.TraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at System.Diagnostics.TraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String format, Object[] args)
   at System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args)
   at PostSharp.VisualStudio.Services.Language.CodeParsingService.CodeElementVisitor.PostSharp.VisualStudio.Services.Language.ICodeElementVisitor.VisitCodeElement(String codeElementName, CodeElement codeElement, String semantic, ICodeLocator codeLocator)
   at PostSharp.VisualStudio.Services.Language.CSharp.CSharpLanguageAdapter.VisitCodeProperty(CodeProperty codeProperty, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeType(CodeType codeType, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, ICodeElementVisitor visitor)
   at PostSharp.VisualStudio.Services.Language.CodeParsingService.GetEnhancedCodeElements(FileCodeModel fileCodeModel)
   at PostSharp.VisualStudio.View.Markers.TextMarkerLayer.ScanSnapshot(ITextSnapshot textSnapshot)
   at PostSharp.VisualStudio.View.Markers.TextMarkerLayer.AddAdornments()
   at PostSharp.VisualStudio.View.Markers.TextMarkerLayer.OnLayoutChangedDelayed(Object sender, EventArgs e)
   at PostSharp.VisualStudio.View.QuietPeriodTimer.OnTick(Object sender, EventArgs e)
   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
14:49:01.331|Trace  |g.TraceLoggerAdapter|1  |#1:Scanning code element Petex.DP.Service.Requests.DpObject_GetDpObjectAllContainingRequest.RelatedToIDs of type vsCMElementProperty. at    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at RedGate.SQLConnect.VsPackage.Logging.TraceLoggerAdapter.WriteLine(String message)
   at System.Diagnostics.TraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String format, Object[] args)
   at System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args)
   at PostSharp.VisualStudio.Services.Language.CodeParsingService.CodeElementVisitor.PostSharp.VisualStudio.Services.Language.ICodeElementVisitor.VisitCodeElement(String codeElementName, CodeElement codeElement, String semantic, ICodeLocator codeLocator)
   at PostSharp.VisualStudio.Services.Language.CSharp.CSharpLanguageAdapter.VisitCodeProperty(CodeProperty codeProperty, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeType(CodeType codeType, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, String parentName, ICodeElementVisitor activator)
   at PostSharp.VisualStudio.Services.Language.BaseLanguageAdapter.VisitCodeElement(CodeElement codeElement, ICodeElementVisitor visitor)
   at PostSharp.VisualStudio.Services.Language.CodeParsingService.GetEnhancedCodeElements(FileCodeModel fileCodeModel)
   at PostSharp.VisualStudio.View.Markers.TextMarkerLayer.ScanSnapshot(ITextSnapshot textSnapshot)
   at PostSharp.VisualStudio.View.Markers.TextMarkerLayer.AddAdornments()
   at PostSharp.VisualStudio.View.Markers.TextMarkerLayer.OnLayoutChangedDelayed(Object sender, EventArgs e)
   at PostSharp.VisualStudio.View.QuietPeriodTimer.OnTick(Object sender, EventArgs e)
   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Any ideas how to stop this as its crippling my dev environment?

Was it helpful?

Solution

This is caused by the combination of the PostSharp and Redgate behaviors.

PostSharp produces trace messages periodically and they are not written to any file normally. You can see the messages only if you enable the diagnostics window in the advanced PostSharp options.

Redgate on the other hand installs trace listeners that catch messages including those produced by the PostSharp and write them to the log files, on top of that it seems to add a stack trace to each message (even if it's not an exception).

It's an unfortunate combination of factors. As for the PostSharp, there's a fix scheduled that will disable tracing completely unless user enables diagnostics window explicitly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top