Autocomplete Textbox TextChanged Event Accessviolation Exception












1















I want to create autocomplete text which is when user typed number, the user typed text+fixed text appears as autocomplete text. So I create autocompleteStringCollection in textchanged event. But it gives me AccessViolationException:




System.AccessViolationException HResult=0x80004003



Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source= Stack trace:




Is there any suggestion?



Here is my code!!!!



private void textbox_TextChanged(object sender,EventsArgs e)
{
AutocompleteStringCollection a=new AutocompleteStringCollection();
if(textbox.Text.Length!=0)
{
a.AddRange(new String{textbox.Text+"greater than",
textbox.Text+"greater than equal"});
}
textbox.AutocompleteCustomSource=a;
}









share|improve this question




















  • 1





    I edited.thank you

    – Zuzan Ko Ko Htet
    Nov 25 '18 at 11:29











  • I think that should work. Hmm. Can you provide the full exception and stack trace (when it pops up you should be able to click "Copy Details")

    – John
    Nov 25 '18 at 11:34











  • System.AccessViolationException HResult=0x80004003 Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source=<Can not evaluate the source of the exception> Stack trace: <Unable to evaluate exception stack trace>

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 0:10











  • Can you try disabling your anti-virus software and then running your application again?

    – John
    Nov 26 '18 at 0:53













  • Okay!! I will test !!

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 1:34
















1















I want to create autocomplete text which is when user typed number, the user typed text+fixed text appears as autocomplete text. So I create autocompleteStringCollection in textchanged event. But it gives me AccessViolationException:




System.AccessViolationException HResult=0x80004003



Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source= Stack trace:




Is there any suggestion?



Here is my code!!!!



private void textbox_TextChanged(object sender,EventsArgs e)
{
AutocompleteStringCollection a=new AutocompleteStringCollection();
if(textbox.Text.Length!=0)
{
a.AddRange(new String{textbox.Text+"greater than",
textbox.Text+"greater than equal"});
}
textbox.AutocompleteCustomSource=a;
}









share|improve this question




















  • 1





    I edited.thank you

    – Zuzan Ko Ko Htet
    Nov 25 '18 at 11:29











  • I think that should work. Hmm. Can you provide the full exception and stack trace (when it pops up you should be able to click "Copy Details")

    – John
    Nov 25 '18 at 11:34











  • System.AccessViolationException HResult=0x80004003 Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source=<Can not evaluate the source of the exception> Stack trace: <Unable to evaluate exception stack trace>

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 0:10











  • Can you try disabling your anti-virus software and then running your application again?

    – John
    Nov 26 '18 at 0:53













  • Okay!! I will test !!

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 1:34














1












1








1








I want to create autocomplete text which is when user typed number, the user typed text+fixed text appears as autocomplete text. So I create autocompleteStringCollection in textchanged event. But it gives me AccessViolationException:




System.AccessViolationException HResult=0x80004003



Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source= Stack trace:




Is there any suggestion?



Here is my code!!!!



private void textbox_TextChanged(object sender,EventsArgs e)
{
AutocompleteStringCollection a=new AutocompleteStringCollection();
if(textbox.Text.Length!=0)
{
a.AddRange(new String{textbox.Text+"greater than",
textbox.Text+"greater than equal"});
}
textbox.AutocompleteCustomSource=a;
}









share|improve this question
















I want to create autocomplete text which is when user typed number, the user typed text+fixed text appears as autocomplete text. So I create autocompleteStringCollection in textchanged event. But it gives me AccessViolationException:




System.AccessViolationException HResult=0x80004003



Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source= Stack trace:




Is there any suggestion?



Here is my code!!!!



private void textbox_TextChanged(object sender,EventsArgs e)
{
AutocompleteStringCollection a=new AutocompleteStringCollection();
if(textbox.Text.Length!=0)
{
a.AddRange(new String{textbox.Text+"greater than",
textbox.Text+"greater than equal"});
}
textbox.AutocompleteCustomSource=a;
}






c#






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 0:51









John

11.9k32038




11.9k32038










asked Nov 24 '18 at 14:24









Zuzan Ko Ko HtetZuzan Ko Ko Htet

62




62








  • 1





    I edited.thank you

    – Zuzan Ko Ko Htet
    Nov 25 '18 at 11:29











  • I think that should work. Hmm. Can you provide the full exception and stack trace (when it pops up you should be able to click "Copy Details")

    – John
    Nov 25 '18 at 11:34











  • System.AccessViolationException HResult=0x80004003 Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source=<Can not evaluate the source of the exception> Stack trace: <Unable to evaluate exception stack trace>

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 0:10











  • Can you try disabling your anti-virus software and then running your application again?

    – John
    Nov 26 '18 at 0:53













  • Okay!! I will test !!

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 1:34














  • 1





    I edited.thank you

    – Zuzan Ko Ko Htet
    Nov 25 '18 at 11:29











  • I think that should work. Hmm. Can you provide the full exception and stack trace (when it pops up you should be able to click "Copy Details")

    – John
    Nov 25 '18 at 11:34











  • System.AccessViolationException HResult=0x80004003 Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source=<Can not evaluate the source of the exception> Stack trace: <Unable to evaluate exception stack trace>

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 0:10











  • Can you try disabling your anti-virus software and then running your application again?

    – John
    Nov 26 '18 at 0:53













  • Okay!! I will test !!

    – Zuzan Ko Ko Htet
    Nov 26 '18 at 1:34








1




1





I edited.thank you

– Zuzan Ko Ko Htet
Nov 25 '18 at 11:29





I edited.thank you

– Zuzan Ko Ko Htet
Nov 25 '18 at 11:29













I think that should work. Hmm. Can you provide the full exception and stack trace (when it pops up you should be able to click "Copy Details")

– John
Nov 25 '18 at 11:34





I think that should work. Hmm. Can you provide the full exception and stack trace (when it pops up you should be able to click "Copy Details")

– John
Nov 25 '18 at 11:34













System.AccessViolationException HResult=0x80004003 Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source=<Can not evaluate the source of the exception> Stack trace: <Unable to evaluate exception stack trace>

– Zuzan Ko Ko Htet
Nov 26 '18 at 0:10





System.AccessViolationException HResult=0x80004003 Message=An attempt was made to perform a read or write operation on protected memory. Other memory may be broken. Source=<Can not evaluate the source of the exception> Stack trace: <Unable to evaluate exception stack trace>

– Zuzan Ko Ko Htet
Nov 26 '18 at 0:10













Can you try disabling your anti-virus software and then running your application again?

– John
Nov 26 '18 at 0:53







Can you try disabling your anti-virus software and then running your application again?

– John
Nov 26 '18 at 0:53















Okay!! I will test !!

– Zuzan Ko Ko Htet
Nov 26 '18 at 1:34





Okay!! I will test !!

– Zuzan Ko Ko Htet
Nov 26 '18 at 1:34












1 Answer
1






active

oldest

votes


















0














Lacking any actuall code to debug, all I can give you is the gist.



AccessViolationException is part of the OS Memory Protection. AV Exceptions usually requires someone handling naked pointers and bleeping stuff up, wich is scarily easy to do.



You usually do not get them in .NET. The designers went out of their way to prevent you from needing to handle naked pointers. There is still a few possible causes:




  • You are using unmanaged code - in particular PINvoke - or unsafe code and thus handle naked pointers

  • You swallow fatal exceptions. After you do that, you get more and less undstandable followup eceptions. This one is just one option. I advise reading these two articles to get the proper handling: https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/ https://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET

  • Binary damage to the .NET libraries

  • 3rd party interference, particular virus scanner. I remember 3-5 years ago we had such an issue with Windows Forms and AVG. And I can remember someone else having similar issues just last week or so...






share|improve this answer



















  • 1





    @ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

    – Christopher
    Nov 25 '18 at 14:46











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459129%2fautocomplete-textbox-textchanged-event-accessviolation-exception%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Lacking any actuall code to debug, all I can give you is the gist.



AccessViolationException is part of the OS Memory Protection. AV Exceptions usually requires someone handling naked pointers and bleeping stuff up, wich is scarily easy to do.



You usually do not get them in .NET. The designers went out of their way to prevent you from needing to handle naked pointers. There is still a few possible causes:




  • You are using unmanaged code - in particular PINvoke - or unsafe code and thus handle naked pointers

  • You swallow fatal exceptions. After you do that, you get more and less undstandable followup eceptions. This one is just one option. I advise reading these two articles to get the proper handling: https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/ https://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET

  • Binary damage to the .NET libraries

  • 3rd party interference, particular virus scanner. I remember 3-5 years ago we had such an issue with Windows Forms and AVG. And I can remember someone else having similar issues just last week or so...






share|improve this answer



















  • 1





    @ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

    – Christopher
    Nov 25 '18 at 14:46
















0














Lacking any actuall code to debug, all I can give you is the gist.



AccessViolationException is part of the OS Memory Protection. AV Exceptions usually requires someone handling naked pointers and bleeping stuff up, wich is scarily easy to do.



You usually do not get them in .NET. The designers went out of their way to prevent you from needing to handle naked pointers. There is still a few possible causes:




  • You are using unmanaged code - in particular PINvoke - or unsafe code and thus handle naked pointers

  • You swallow fatal exceptions. After you do that, you get more and less undstandable followup eceptions. This one is just one option. I advise reading these two articles to get the proper handling: https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/ https://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET

  • Binary damage to the .NET libraries

  • 3rd party interference, particular virus scanner. I remember 3-5 years ago we had such an issue with Windows Forms and AVG. And I can remember someone else having similar issues just last week or so...






share|improve this answer



















  • 1





    @ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

    – Christopher
    Nov 25 '18 at 14:46














0












0








0







Lacking any actuall code to debug, all I can give you is the gist.



AccessViolationException is part of the OS Memory Protection. AV Exceptions usually requires someone handling naked pointers and bleeping stuff up, wich is scarily easy to do.



You usually do not get them in .NET. The designers went out of their way to prevent you from needing to handle naked pointers. There is still a few possible causes:




  • You are using unmanaged code - in particular PINvoke - or unsafe code and thus handle naked pointers

  • You swallow fatal exceptions. After you do that, you get more and less undstandable followup eceptions. This one is just one option. I advise reading these two articles to get the proper handling: https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/ https://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET

  • Binary damage to the .NET libraries

  • 3rd party interference, particular virus scanner. I remember 3-5 years ago we had such an issue with Windows Forms and AVG. And I can remember someone else having similar issues just last week or so...






share|improve this answer













Lacking any actuall code to debug, all I can give you is the gist.



AccessViolationException is part of the OS Memory Protection. AV Exceptions usually requires someone handling naked pointers and bleeping stuff up, wich is scarily easy to do.



You usually do not get them in .NET. The designers went out of their way to prevent you from needing to handle naked pointers. There is still a few possible causes:




  • You are using unmanaged code - in particular PINvoke - or unsafe code and thus handle naked pointers

  • You swallow fatal exceptions. After you do that, you get more and less undstandable followup eceptions. This one is just one option. I advise reading these two articles to get the proper handling: https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/ https://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET

  • Binary damage to the .NET libraries

  • 3rd party interference, particular virus scanner. I remember 3-5 years ago we had such an issue with Windows Forms and AVG. And I can remember someone else having similar issues just last week or so...







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 '18 at 14:53









ChristopherChristopher

2,8471623




2,8471623








  • 1





    @ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

    – Christopher
    Nov 25 '18 at 14:46














  • 1





    @ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

    – Christopher
    Nov 25 '18 at 14:46








1




1





@ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

– Christopher
Nov 25 '18 at 14:46





@ZuzanKoKoHtet Nothing in the code you showed should cause this exception. So we can excldue option 1. that still leaves the 3 others that only you can debug.

– Christopher
Nov 25 '18 at 14:46


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459129%2fautocomplete-textbox-textchanged-event-accessviolation-exception%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks