Click here to Skip to main content
15,889,867 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# error Pin
Richard MacCutchan7-Jul-13 7:21
mveRichard MacCutchan7-Jul-13 7:21 
GeneralRe: c# error Pin
User34907-Jul-13 8:28
User34907-Jul-13 8:28 
GeneralRe: c# error Pin
Richard MacCutchan7-Jul-13 20:38
mveRichard MacCutchan7-Jul-13 20:38 
QuestionC# SQL SELECT query taking too long Pin
IceUK5-Jul-13 5:48
IceUK5-Jul-13 5:48 
AnswerRe: C# SQL SELECT query taking too long Pin
fixthebugg5-Jul-13 6:00
fixthebugg5-Jul-13 6:00 
AnswerRe: C# SQL SELECT query taking too long Pin
Simon_Whale5-Jul-13 6:14
Simon_Whale5-Jul-13 6:14 
AnswerRe: C# SQL SELECT query taking too long Pin
Mycroft Holmes5-Jul-13 14:03
professionalMycroft Holmes5-Jul-13 14:03 
QuestionI am geting an error about callbackOnCollectedDelegate Pin
mahua225-Jul-13 2:11
mahua225-Jul-13 2:11 
I'm getting the folloiwng error:

A callback was made on a garbage collected delegate of type 'OPC_Library!OPC_Library.OPC_DLL+WriteNotificationDelegate::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.

I m creating an opc server,I have a form opcSrvr & a .cs file called TcpCommServer,
my code is here:
opcSrvr.cs


OPC_DLL.WriteNotificationDelegate writeCallBack;
public static TcpCommServer.ServerCallbackDelegate del;
TcpCommServer _Server;

public opcSrvr()
{
InitializeComponent();
writeCallBack = new OPC_DLL.WriteNotificationDelegate(myWriteCallBack);
del += new Airsprint_OPCServer.TcpCommServer.ServerCallbackDelegate(UpdateUI);
_Server = new Airsprint_OPCServer.TcpCommServer(del);
}

public void UpdateUI(byte[] bytes, Int32 sessionID, int dataChannel)
{

if (this.InvokeRequired)
{
this.Invoke(_Server.ServerCallbackObject, bytes, sessionID, dataChannel);
}
else
{
// the usual stuff
}
}

public void myWriteCallBack(UInt32 hItem, ref Object Value, ref UInt32 ResultCode)
{
ResultCode = 0;
try
{
ResultCode = 0;
if (hItem == TagHandle[0])
{
textBox1.Text = Convert.ToString (Value);
OPC_DLL.UpdateTag.UpdateTag(TagHandle[0], textBox1.Text, 192);
}
if (hItem == TagHandle[1])
{
textBox2.Text = Convert.ToString(Value);
OPC_DLL.UpdateTag.UpdateTag(TagHandle[1], textBox2.Text, 192);
}
if (hItem == TagHandle[2])
{
textBox3.Text = Convert.ToString(Value);
OPC_DLL.UpdateTag.UpdateTag(TagHandle[2], textBox3.Text, 192);
}
if (hItem == TagHandle[3])
{
textBox4.Text = Convert.ToString(Value);
OPC_DLL.UpdateTag.UpdateTag(TagHandle[3], textBox4.Text, 192);
}
}
catch(Exception ex)
{
}

}

private void opcSrvr_Load(object sender, EventArgs e)
{
OPC_DLL.InitWTOPCsvr("{638A1D6E-D7CD-45F4-98E7-ADEB72218DA3}", 1000);
OPC_DLL.EnableWriteNotification(myWriteCallBack, true);
TagHandle[0] = OPC_DLL.CreateTag("Tag.1", textBox1.Text, 192, true);
TagHandle[1] = OPC_DLL.CreateTag("Tag.2", textBox2.Text, 192, true);
TagHandle[2] = OPC_DLL.CreateTag("Tag.3", textBox3.Text, 192, true);
TagHandle[3] = OPC_DLL.CreateTag("Tag.4", textBox4.Text, 192, true);
}


opc.dll is the file which contain all required dll's. its a multithreading programming.can you tell me how to fix this error? am i doing any mistake in initialization? plz help me!!!
AnswerRe: I am geting an error about callbackOnCollectedDelegate Pin
Ron Beyer5-Jul-13 3:40
professionalRon Beyer5-Jul-13 3:40 
AnswerRe: I am geting an error about callbackOnCollectedDelegate Pin
Alan N5-Jul-13 3:48
Alan N5-Jul-13 3:48 
GeneralRe: I am geting an error about callbackOnCollectedDelegate Pin
Ron Beyer5-Jul-13 4:44
professionalRon Beyer5-Jul-13 4:44 
QuestionDifference between {list}.First() and {list}[0] Pin
velvet75-Jul-13 0:59
velvet75-Jul-13 0:59 
AnswerRe: Difference between {list}.First() and {list}[0] Pin
Marco Bertschi5-Jul-13 1:18
protectorMarco Bertschi5-Jul-13 1:18 
AnswerRe: Difference between {list}.First() and {list}[0] Pin
Nicholas Marty5-Jul-13 1:24
professionalNicholas Marty5-Jul-13 1:24 
AnswerRe: Difference between {list}.First() and {list}[0] Pin
Pete O'Hanlon5-Jul-13 3:19
mvePete O'Hanlon5-Jul-13 3:19 
AnswerRe: Difference between {list}.First() and {list}[0] Pin
Abhinav S6-Jul-13 1:41
Abhinav S6-Jul-13 1:41 
Questionunable to insert data Pin
new to c# programming4-Jul-13 21:49
new to c# programming4-Jul-13 21:49 
AnswerRe: unable to insert data Pin
Pete O'Hanlon4-Jul-13 21:58
mvePete O'Hanlon4-Jul-13 21:58 
GeneralRe: unable to insert data Pin
new to c# programming4-Jul-13 22:48
new to c# programming4-Jul-13 22:48 
AnswerRe: unable to insert data Pin
Simon_Whale4-Jul-13 22:02
Simon_Whale4-Jul-13 22:02 
GeneralRe: unable to insert data Pin
new to c# programming4-Jul-13 22:49
new to c# programming4-Jul-13 22:49 
QuestionC# shuffle one column out of two Pin
yandroide4-Jul-13 10:14
yandroide4-Jul-13 10:14 
AnswerRe: C# shuffle one column out of two Pin
Eddy Vluggen4-Jul-13 10:21
professionalEddy Vluggen4-Jul-13 10:21 
AnswerRe: C# shuffle one column out of two Pin
thanh_bkhn4-Jul-13 19:03
professionalthanh_bkhn4-Jul-13 19:03 
QuestionSplit string in multiple strings Pin
Sachin k Rajput 4-Jul-13 1:46
Sachin k Rajput 4-Jul-13 1:46 

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.