Postsharp Resharper Redgate Excessive Logging - resharper

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?

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.

Related

How can I make my Game Maker Studio 2 project run properly on an Android Emulator?

I have been trying to test my gms2 project on an android emulator from android studio. I first set up the sdk, using this article as a guide https:
//help.yoyogames.com/hc/en-us/articles/115001368727-Setting-Up-For-Android-or-Amazon-Fire
Then, I used this article:
https://help.yoyogames.com/hc/en-us/articles/115000270191-Android-Setting-Up-Virtual-Devices
to set up virtual android devices. One thing I did note when doing this was that the HAXM installer failed every time, this is what I saw
For more details, please check the installation log: C:\Users\GRAHAM~1\AppData\Local\Temp\haxm_install-20210917_0928.log
IntelĀ® HAXM installation failed. To install IntelĀ® HAXM follow the instructions found at: https://github.com/intel/haxm/wiki/Installation-Instructions-on-Windows
Done
This is what I saw on the SDK manager
This may be related, I'm not sure. But then, I went into gms2 and followed everything in the articles, but when I tried to run the project, I got the following output:
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
-----------------------------------------------------------------------------
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
-----------------------------------------------------------------------------
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\a839beeab34845389c4d01131e83e7cd.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\02db8f82f77e49a5a8414617cce166e6.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\b040736233304be79cc6c2d2c53ad089.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\27f7125ae7a047debcc5b7463282ace9.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\ef897878cf614509afbba924f24b0806.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\bcd410e5ac854919bb7b9486c6f6866c.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
EXCEPTION FILE - C:\Users\GRAHAMJT20\AppData\Local\Temp\5f27bb810dc041b9b7b79c4c98eab7ed.yyg.saencryptedreport
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GMAssetCompiler.TexturePage.(String )
at GMAssetCompiler.TexturePage.(String , Boolean , Boolean , Boolean , Boolean , Int32 , String , String , String[] )
at GMAssetCompiler.WADSaver`1.<>c.(KeyValuePair`2 )
at GMAssetCompiler.Program..(Object )
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
This is all a bit over my head to be honest. Any help getting this to work would be appreciated.
(There was more to the error output that I can provide if needed, it was too long to put here though)

Adding subitemID column in the Sales Prices Grid but I get an error

I want to add the subitemID column in the grid of the sales prices screen, I already added it but I get an error when opening the screen, see the screenshot below:
This is the error:
Error: An error occurred during processing of the field Inventory ID: Specified cast is not valid..
System.InvalidCastException: Specified cast is not valid.
at System.Data.SqlClient.SqlBuffer.get_Int32()
at PX.Data.PXDataRecord.GetInt32(Int32 i) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Record.cs:line 458
at PX.Data.PXDBIdentityAttribute.RowSelecting(PXCache sender, PXRowSelectingEventArgs e) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Descriptor\Attributes\DBFieldAttribute.cs:line 4624
at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Cache\ModelEventHandling.cs:line 399
at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Cache\ModelEventHandling.cs:line 315
at PX.Data.PXCache`1.Select(PXDataRecord record, Int32& position, Boolean isReadOnly, Boolean& wasUpdated) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Cache\Model.cs:line 3932
at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 3588
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 5943
at PX.Objects.AR.ARSalesPriceMaint.QSelect(PXGraph graph, BqlCommand bqlCommand, Object[] viewParameters) in C:\Bld\AC-FULL2019R214-JOB1\Sources\WebSites\Pure\PX.Objects\AR\ARSalesPriceMaint.cs:line 183
at PX.Objects.AR.ARSalesPriceMaint.d__14.MoveNext() in C:\Bld\AC-FULL2019R214-JOB1\Sources\WebSites\Pure\PX.Objects\AR\ARSalesPriceMaint.cs:line 154
at System.Linq.Enumerable.d__95`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at PX.Data.PXView.ToList(IEnumerable src) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 6458
at _CustomMethod(Object , Object[] )
at PX.Data.PXView.InvokeDelegate(Object[] parameters) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 6508
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 5862
at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Graph\Graph.cs:line 3422
These are the attributes of the SubItemID column:
[PXDBInt]
[PXUIField(DisplayName="SubItemID")]
[PXDefault(typeof(Search<InventoryItem.defaultSubItemID,
Where<InventoryItem.inventoryID, Equal<Current<ARSalesPrice.inventoryID>>,
And<InventoryItem.defaultSubItemOnEntry, Equal<boolTrue>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]
[PXFormula(typeof(Default<ARSalesPrice.inventoryID>))]
[SubItem(typeof(ARSalesPrice.inventoryID))]
[SubItemStatusVeryfier(typeof(ARSalesPrice.inventoryID), typeof(ARSalesPrice.siteID), InventoryItemStatus.Inactive, InventoryItemStatus.NoSales)]
I want to creat it like the Sales Orders screen, see the screenshot below:
Can you help me with this?

CrossItem causes invalid Id error

I have had added CrossItem attribute to the InventoryID field in Appointments page. But, this caused inventory id invalid cast issue.
This is how I have added the attribute to the property.
And here is the stack trace of it.
1/4/2018 10:56:49 AM Error:
Error: An error occurred during processing of the field Inventory ID : Specified cast is not valid..
System.InvalidCastException: Specified cast is not valid.
at System.Data.SqlClient.SqlBuffer.get_Int32()
at PX.Data.PXDataRecord.GetInt32(Int32 i)
at PX.Data.PXDBIntAttribute.RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly)
at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly)
at PX.Data.PXCache`1.Select(PXDataRecord record, Int32& position, Boolean isReadOnly, Boolean& wasUpdated)
at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter)
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Data.PXView.SelectMultiBound(Object[] currents, Object[] parameters)
at PX.Data.PXSelectBase`1.selectBound(Object[] currents, Object[] arguments)
at PX.Objects.FS.AppointmentEntry.FSServiceOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e) in F:\Bld2\AC-FULL2017R201-JOB1\sources\WebSites\Pure\PX.Objects.FS\AppointmentEntry.cs:line 6983
at PX.Data.PXRowSelected.Invoke(PXCache sender, PXRowSelectedEventArgs e)
at PX.Data.PXCache.OnRowSelected(Object item)
at PX.Data.PXCache`1.set_Current(Object value)
at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)
at PX.Web.UI.PXDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)
at PX.Web.UI.PXDataSourceView.Select(DataSourceSelectArguments arguments, PXDSSelectArguments swarguments, DataSourceViewSelectCallback callback)
at PX.Web.UI.PXFormDataProvider.DataBind()
at PX.Web.UI.PXBoundPanel.PerformSelect()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at PX.Web.UI.PXBoundPanel.OnAfterSelect(PXFormDataProvider provider)
at PX.Web.UI.PXFormDataProvider.a(IEnumerable A_0)
at PX.Web.UI.PXFormDataProvider.DataBind()
at PX.Web.UI.PXCallbackManager.a(Dictionary`2 A_0, List`1 A_1)
at PX.Web.UI.PXCallbackManager.a(PXCallbackResultMethod A_0, XmlWriter A_1)
at PX.Web.UI.PXCallbackManager.a(PXCallbackResultMethod A_0)
I have had the same issue in Service Orders page too. How do I resolve this issue?
Thanks.
This error happens because of duplicated attributes on the InventoryID field: the Append to Original option will always append the list of original attributes with your custom ones.
The error should be resolved after you switch to the Replace Original option, as shown in the screenshot below:

Response is not available in this context

This is what the exception I am getting while running an Web project which is migrated from Asp.net to Windows Azure Cloud. If I try to run the ASP.net application it is fine, but after migrating to Windows Azure Cloud I am getting the following exception. There is no clue for me to find a solution, please someon do the needful..
**Exception:**
Server.GetLastError().GetBaseException()
{"Response is not available in this context."}
[System.Web.HttpException]: {"Response is not available in this context."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Response is not available in this context."
Source: "System.Web"
StackTrace: " at System.Web.UI.Page.get_Response()\r\n at Writehome_aspxToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )\r\n at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declare
dType)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at WritePlaceHolderToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )\r\n at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.S
erializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at WriteArrayOfControlToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , Collection
DataContract )\r\n at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDec
laredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at WriteArrayOfanyTypeToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )\r\n at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n a
t System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at System.Runtime.Serialization.XmlObjectSerializerWriteContextComplex.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n at WriteSerializableSessionStateStoreDataToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )\r\n at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n at System.Runtime.Serialization.NetDataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContract contract, Hashtable surrogateDataContracts)\r\n at System.Runtime.Serialization.NetDataContractSerializer.InternalWr
iteObject(XmlWriterDelegator writer, Object graph)\r\n at System.Runtime.Serialization.XmlObjectSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)\r\n at Microsoft.ApplicationServer.Caching.NetDataContractCacheObjectSerializer.Serialize(Stream stream, Object value)\r\n at Microsoft.ApplicationServer.Caching.DataCacheObjectSerializationProvider.SerializeUserObject(Object userObject, Boolean isCompressionEnabled, ValueFlagsVersion flagsType)\r\n at Microsoft.ApplicationServer.Caching.SocketClientProtocol.SerializeValue(Object obj)\r\n at Microsoft.ApplicationServer.Caching.SocketClientProtocol.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle,
TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener)\r\n at Microsoft.ApplicationServer.Caching.DataCache.InternalPutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener)\r\n at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass9c.<PutAndUnlock>b__9b()\r\n at Microsoft.ApplicationServer.Caching.MonitoringListenerFactory.EmptyListener.Microsoft.ApplicationServer.Caching.IMonitoringListener.Listen[TResult](Func`1 innerDelegate)\r\n at Microsoft.ApplicationServer.Caching.DataCache.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout)\r\n at Microsoft.Web.DistributedCache.DataCacheWrapper.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout)\r\n at Microsoft.Web.DistributedCache.DataCacheForwarderBase.<>c__DisplayClass1c.<PutAndUnlock>b__1b()\r\n at Microsoft.Web.DistributedCache.DataCacheFo
rwarderBase.<>c__DisplayClass31`1.<PerformCacheOperation>b__30()\r\n at Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action)\r\n at Microsoft.Web.DistributedCache.DataCacheForwarderBase.PerformCacheOperation[TResult](Func`1 func)\r\n at Microsoft.Web.DistributedCache.DataCacheForwarderBase.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout)\r\n at Microsoft.Web.DistributedCache.BlobBasedSessionStoreProvider.SetAndReleaseItemExclusive(HttpContextBase context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)\r\n at Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)\r\n at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)\r\n at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Exec
ute()\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)"
TargetSite: {System.Web.HttpResponse get_Response()}
It happens if you try to do Azure stuff like accessing the blob in the Application_Start method.
It was because HttpContext.Current.Response was accessible.Azure uses the Response object for logging. In any case, if you need to access the blob in your web app or do any other Azure stuff AND want to do this even though there is not a Response object, like in the Application_Start method. You simply set HttpContext.Current to null, but in a smart way.
Application_Start is as below
protected void Application_Start(object sender, EventArgs e)
{
CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
{
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
});
using (new AzureContext())
{
CloudStorageAccount storageAccount = CloudStorageAccount.FromConfigurationSetting("BlobConnectionString");
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
container.CreateIfNotExist();
container.FetchAttributes();
}
}
AzureContext is as below :
public class AzureContext : IDisposable
{
HttpContext _oldHttpContext;
bool _restoreOldHttpContext = false;
public AzureContext(bool forceSettingContextToNull = false)
{
if (forceSettingContextToNull)
{
_oldHttpContext = HttpContext.Current;
HttpContext.Current = null;
_restoreOldHttpContext = true;
}
else
{
try
{
HttpResponse response = HttpContext.Current.Response;
}
catch (HttpException)
{
_oldHttpContext = HttpContext.Current;
HttpContext.Current = null;
_restoreOldHttpContext = true;
}
}
}
public void Dispose(bool disposing)
{
if (disposing)
{
if (_restoreOldHttpContext)
{
HttpContext.Current = _oldHttpContext;
}
}
}
public void Dispose()
{
Dispose(true);
}
~AzureContext()
{
Dispose(false);
}
}
For more information check this out Azure and Response is not available in this context
I hope this will help to you.
I suffered because of this issue... You can resolve this issue by applying this patch...
http://support.microsoft.com/kb/2468871
I had applied this patch in my local environment and as well as in the cloud environment (using startup role). But you may not need to patch the cloud environment now because they might updated. You can contact Azure support( India : 1-(866) 676-6546) regarding this issue if the issues is still exist in the cloud, They will help you with applying the patch.
Thank for all your help, finnally i have found out the reason for the issue. Issue occured because I was trying to store the the System.Web.UI.WebControls into a session.
Since not all System.Web.UI.WebControls are serilizable, so avoid storind WebControls to session.
Happy coding..

SPUserCodeSolutionExecutionFailedException

I have a simple sandbox solution with a webpart (which loads data via Linq but thats not the point I think) and everything works fine on my development machine.
When I install this solution on another machine and add the webpart to a page I get the following exception. But I don't know why and what to do and I think its not related to my solution as I can't see any reference to my application in the stack trace.
Any idea?
Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.
[SPUserCodeSolutionExecutionFailedException: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.]
Server stack trace:
at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext, Boolean shouldUsageLog, Int32 currentProcessId)
at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext, Boolean shouldUsageLog, Int32 currentProcessId)
at Microsoft.SharePoint.UserCode.SPUserCodeAppDomain.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext, Boolean shouldUsageLog, Int32 currentProcessId)
at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcessProxyForShim.ExecuteInternal(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext)
at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcessProxy.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.ExecuteDelegate.EndInvoke(IAsyncResult result)
at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, SPUserToken userToken, String currentAffinity, SPUserCodeExecutionContext executionContext)
at Microsoft.SharePoint.UserCode.SPUserCodePoolableProcessConnection.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)
at Microsoft.SharePoint.UserCode.SPUserCodeExecutionHost.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [1]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.SharePoint.Administration.ISPUserCodeExecutionHostProxy.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinityBucketName, SPUserCodeExecutionContext executionContext)
at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.Execute(Type userCodeWrapperType, SPSite site, SPUserCodeExecutionContext executionContext)
at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.<>c_DisplayClassa.b_9()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.ExecuteRequestInSandBox(HttpContext context, SPWeb web, SPWebPartManager manager, SPUserCodeWebPart userCodeWebPart)
[NullReferenceException: Object reference not set to an instance of an object.]
Server stack trace:
at Microsoft.SharePoint.Utilities.SPThreadContext.get_UserCodeContext()
at Microsoft.SharePoint.Utilities.SPThreadContext.get_Items()
at Microsoft.SharePoint.Utilities.SPThreadContext.Get(String key)
at Microsoft.SharePoint.Utilities.SPThreadContext.GetT
at Microsoft.SharePoint.Library.SPRequest.Dispose(Boolean disposing)
at Microsoft.SharePoint.Library.SPRequest.Dispose()
at Microsoft.SharePoint.SPWeb.InvalidateRequest()
at Microsoft.SharePoint.SPWeb.Invalidate()
at Microsoft.SharePoint.SPWeb.Close()
at Microsoft.SharePoint.SPSite.Close()
at Microsoft.SharePoint.SPSite.Dispose()
at Microsoft.SharePoint.SPSite_SubsetProxy.Dispose__Inner()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.SharePoint.SPSite_SubsetProxy.Dispose()
at Microsoft.SharePoint.SPSite.Dispose__Inner()
at Microsoft.SharePoint.SPSite.Dispose()
at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.Execute(SPUserCodeExecutionContext executionContext)
at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.ExecuteWrapper(SPUserCodeWrapper wrapper, SPUserCodeExecutionContext executionContext)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [1]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.CodeToExecuteWrapper.EndInvoke(IAsyncResult result)
at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext, Boolean shouldUsageLog, Int32 currentProcessId)
Check if sandboxed solutions are enabled (correspoding service is running on your server). Also check if you are actually installing this solution as a sandboxed, not as a regular or vice versa.

Resources