473,386 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error: "CallbackOnCollectedDelegate was detected"

ebj
I get this error message from time to time in my new app:

"CallbackOnCollectedDelegate was detected
Message: A callback was made on a garbage collected delegate of type
'System.Windows.Forms!System.Windows.Forms.NativeM ethods+WndProc::Invoke'.
This may cause application crashes, corruption and data loss. When passing
delegates to unmanaged code, they must be kept alive by the managed
application until it is guaranteed that they will never be called."

The same code was running without any problems under Visual Studio 2005 Beta
2, but after upgrade to Visual Studio 2005 Professional and the final release
of .NET, I get this error.

Sometimes the code runs without any problems!

What can I do to prevent this from happen?

Dec 31 '05 #1
3 6991
Hello,

Such an error may happen when a delegate is marshaled from managed code to
unmanaged code as a function pointer and a callback was put on the function
pointer, but the delegate was collected by GC. Is there same logic in your
code? Have you locate the exact line that the error happened?

Luke

Jan 3 '06 #2
ebj
Hello and tank’s fore your answer.
That was what my problem was, it occur on different places in my code, where
I change the visibility or enable/disabled controls (textbox or combobox)

After rewriting the code, the problem seems to be solved.

Einar

"[MSFT]" wrote:
Hello,

Such an error may happen when a delegate is marshaled from managed code to
unmanaged code as a function pointer and a callback was put on the function
pointer, but the delegate was collected by GC. Is there same logic in your
code? Have you locate the exact line that the error happened?

Luke

Jan 3 '06 #3
The problem is still unclear here. If you encountet such a problem again,
and rewriting code wouldn't fix it, you may try to delete the related
control from the form, or re-create the whole form to see if it can help.

Luke

Jan 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Matt Bostock | last post by:
Hi, When I validate this page: http://www.drfunkenstein.net/using http://jigsaw.w3.org/css-validator/, I get the following results: ...
3
by: Laura | last post by:
I've just installed the DB2 Run-time client in a Solaris machine. Then I finnish the installation configuring the connection: 1. machine catalog was OK: ========================== $ db2 catalog...
0
by: GB | last post by:
All, I raised a problem a while ago about custom cultures in .NET and an error whereby a "Resource lookup failed - infinite recursion detected" exception was raised. Usually this was raised when...
3
by: Pierre Barbier de Reuille | last post by:
Hi, after reading the article " The Standard Librarian : Defining Iterators and Const Iterators" from Matt Austern:...
3
by: NaeiKinDus | last post by:
Hello, i'm trying to program a thread that would be locked (by a mutex) and that would only be unlocked once that a function (generating data) is done. The purpose is to generate data, and unlock...
2
by: John M. Gamble | last post by:
I'm getting this message in Visual Studio 2005: PInvokeStackImbalance was detected Message: A call to PInvoke function 'Refresh!Refresh.Main::WNetAddConnection2' has unbalanced the stack. ...
10
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are...
3
by: cie | last post by:
Hi, anyone please help me when I try to close a connection to the database from a static method, "Unreachable code detected" error occured. What's the problem actually? Thank you before
1
by: itxharsh | last post by:
/* While running the program a runtime error occurs."glibc detected" followed by a lot of memory address/instruction errors. Please help rectify this error.*/ /*Header file:"nonpreemptive.h" is as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.