Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
AnswerRe: Early session timeout in asp.net for multiple sessions Pin
OriginalGriff30-Jul-17 20:25
mveOriginalGriff30-Jul-17 20:25 
JokeC# WeakClone and DeepClone Pin
Jeong, WonYoung(Brad)28-Jul-17 20:12
professionalJeong, WonYoung(Brad)28-Jul-17 20:12 
GeneralRe: C# WeakClone and DeepClone Pin
Pete O'Hanlon29-Jul-17 3:23
mvePete O'Hanlon29-Jul-17 3:23 
GeneralRe: C# WeakClone and DeepClone Pin
Jeong, WonYoung(Brad)29-Jul-17 12:34
professionalJeong, WonYoung(Brad)29-Jul-17 12:34 
GeneralRe: C# WeakClone and DeepClone Pin
BillWoodruff29-Jul-17 6:18
professionalBillWoodruff29-Jul-17 6:18 
GeneralRe: C# WeakClone and DeepClone Pin
Jeong, WonYoung(Brad)29-Jul-17 12:36
professionalJeong, WonYoung(Brad)29-Jul-17 12:36 
GeneralRe: C# WeakClone and DeepClone Pin
BillWoodruff29-Jul-17 17:55
professionalBillWoodruff29-Jul-17 17:55 
QuestionIntermittent AccessViolationException with richtextbox Pin
shrishjain27-Jul-17 20:28
shrishjain27-Jul-17 20:28 
I am using VS 2015 with .Net framework 5.2.1 and winforms. The rich text box calls are making the application crash intermittently

with System.AccessViolationException:

At the bottom there is error from Event Viewer and it seems it is crashing while setting Selection start. I set Selection start at two

places in my code. The crash is intermittent. I will really appreciate any pointers.
1) While scrolling it to the bottom:
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.ScrollToCaret();
2) while appending text to the richtextbox:
public static void AppendText(this RichTextBox box, string text, Color color)
{
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;
box.SelectionColor = color;
box.AppendText(text);
}

EventViewer:

Application: AutomationHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.NativeWindow.DefWndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.DefWndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.TextBoxBase.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.RichTextBox.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef, Int32, Int32, EDITSTREAM)
at System.Windows.Forms.RichTextBox.StreamOut(System.IO.Stream, Int32, Boolean)
at System.Windows.Forms.RichTextBox.StreamOut(Int32)
at System.Windows.Forms.RichTextBox.get_SelectedText()
at System.Windows.Forms.RichTextBox.get_SelectionLength()
at System.Windows.Forms.TextBoxBase.set_SelectionStart(Int32)
at AutomationHostHelper.Test.ThreadSafeRichTextBox()

Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback,

System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object,

Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.TextBoxBase.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.RichTextBox.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
at System.Windows.Forms.Application

+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
at AutomationHost.Program.Main(System.String[])
QuestionRe: Intermittent AccessViolationException with richtextbox Pin
Jochen Arndt27-Jul-17 23:01
professionalJochen Arndt27-Jul-17 23:01 
QuestionGet host name from different segment of LAN Pin
w1424327-Jul-17 17:39
w1424327-Jul-17 17:39 
AnswerRe: Get host name from different segment of LAN Pin
Jochen Arndt27-Jul-17 22:04
professionalJochen Arndt27-Jul-17 22:04 
AnswerRe: Get host name from different segment of LAN Pin
Nathan Minier28-Jul-17 1:19
professionalNathan Minier28-Jul-17 1:19 
AnswerRe: Get host name from different segment of LAN Pin
Member 1333447128-Jul-17 8:42
Member 1333447128-Jul-17 8:42 
QuestionCOM and C#.net Interoperability Pin
Vijjuuu.26-Jul-17 8:59
Vijjuuu.26-Jul-17 8:59 
AnswerRe: COM and C#.net Interoperability Pin
Richard MacCutchan26-Jul-17 10:05
mveRichard MacCutchan26-Jul-17 10:05 
AnswerRe: COM and C#.net Interoperability Pin
Bernhard Hiller26-Jul-17 22:05
Bernhard Hiller26-Jul-17 22:05 
GeneralRe: COM and C#.net Interoperability Pin
Vijjuuu.27-Jul-17 7:27
Vijjuuu.27-Jul-17 7:27 
GeneralRe: COM and C#.net Interoperability Pin
Pete O'Hanlon27-Jul-17 20:46
mvePete O'Hanlon27-Jul-17 20:46 
AnswerRe: COM and C#.net Interoperability Pin
BenScharbach12-Aug-17 10:21
BenScharbach12-Aug-17 10:21 
QuestionIssue with the below code Pin
Paul McGann25-Jul-17 22:44
professionalPaul McGann25-Jul-17 22:44 
AnswerRe: Issue with the below code Pin
F-ES Sitecore25-Jul-17 23:00
professionalF-ES Sitecore25-Jul-17 23:00 
GeneralRe: Issue with the below code Pin
Paul McGann26-Jul-17 3:14
professionalPaul McGann26-Jul-17 3:14 
AnswerRe: Issue with the below code Pin
Nathan Minier26-Jul-17 1:23
professionalNathan Minier26-Jul-17 1:23 
GeneralRe: Issue with the below code Pin
Paul McGann26-Jul-17 3:14
professionalPaul McGann26-Jul-17 3:14 
AnswerRe: Issue with the below code Pin
BillWoodruff26-Jul-17 4:00
professionalBillWoodruff26-Jul-17 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.