Object when passed as a parameter won't initialize in c# and fails
I am trying to pass an object to a method in C# and I am observing that the formal parameter is not being referred to the actual parameter.
My method to which I am passing the object is
public DetailedTSClientInfo GetCommonServerDetails(string servername,DetailedTSClientInfo detailedTsClientInfo)
{}
And I am calling the above method from the below function
public DetailedTSClientInfo GetAppserverDetails(TSClientAddress client)
{
var appServer = client.ClientIISserver.ToUpper();
DetailedTSClientInfo detailedTsClientInfo = new DetailedTSClientInfo();
detailedTsClientInfo.Name = appServer;
detailedTsClientInfo = GetCommonServerDetails(appServer,detailedTsClientInfo);
I tried using ref
and out
for this object. However, everytime I get this error which says "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." and I am not able to get a work around for this.
(Attached an image which shows the error message)
Could anyone please help?
Thanks in advance!
[Edit-1]
Here is the exception which I am encountering.
c#
|
show 11 more comments
I am trying to pass an object to a method in C# and I am observing that the formal parameter is not being referred to the actual parameter.
My method to which I am passing the object is
public DetailedTSClientInfo GetCommonServerDetails(string servername,DetailedTSClientInfo detailedTsClientInfo)
{}
And I am calling the above method from the below function
public DetailedTSClientInfo GetAppserverDetails(TSClientAddress client)
{
var appServer = client.ClientIISserver.ToUpper();
DetailedTSClientInfo detailedTsClientInfo = new DetailedTSClientInfo();
detailedTsClientInfo.Name = appServer;
detailedTsClientInfo = GetCommonServerDetails(appServer,detailedTsClientInfo);
I tried using ref
and out
for this object. However, everytime I get this error which says "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." and I am not able to get a work around for this.
(Attached an image which shows the error message)
Could anyone please help?
Thanks in advance!
[Edit-1]
Here is the exception which I am encountering.
c#
1
What you are witnessing are debugger anomalies. What is the actual problem you are experiencing in terms of your program itself.
– Kirk Woll
Jan 1 at 19:37
As the object is failing to initialize, my function fails to run and throws an exception with the same error message. Is there any way I can get around this?
– Kalyana Srinivas
Jan 1 at 19:39
I do not understand what you mean by "failing to initialize". Also, as that error message "Unable to evaluate expression" is entirely a debugger message, that is not the error that is causing an actual real exception for you.
– Kirk Woll
Jan 1 at 19:40
What exception do you get when you run it?
– CodingYoshi
Jan 1 at 19:43
1
Also, are you compiling under theDebug
configuration orRelease
? The latter impedes debugging.
– Kirk Woll
Jan 1 at 19:58
|
show 11 more comments
I am trying to pass an object to a method in C# and I am observing that the formal parameter is not being referred to the actual parameter.
My method to which I am passing the object is
public DetailedTSClientInfo GetCommonServerDetails(string servername,DetailedTSClientInfo detailedTsClientInfo)
{}
And I am calling the above method from the below function
public DetailedTSClientInfo GetAppserverDetails(TSClientAddress client)
{
var appServer = client.ClientIISserver.ToUpper();
DetailedTSClientInfo detailedTsClientInfo = new DetailedTSClientInfo();
detailedTsClientInfo.Name = appServer;
detailedTsClientInfo = GetCommonServerDetails(appServer,detailedTsClientInfo);
I tried using ref
and out
for this object. However, everytime I get this error which says "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." and I am not able to get a work around for this.
(Attached an image which shows the error message)
Could anyone please help?
Thanks in advance!
[Edit-1]
Here is the exception which I am encountering.
c#
I am trying to pass an object to a method in C# and I am observing that the formal parameter is not being referred to the actual parameter.
My method to which I am passing the object is
public DetailedTSClientInfo GetCommonServerDetails(string servername,DetailedTSClientInfo detailedTsClientInfo)
{}
And I am calling the above method from the below function
public DetailedTSClientInfo GetAppserverDetails(TSClientAddress client)
{
var appServer = client.ClientIISserver.ToUpper();
DetailedTSClientInfo detailedTsClientInfo = new DetailedTSClientInfo();
detailedTsClientInfo.Name = appServer;
detailedTsClientInfo = GetCommonServerDetails(appServer,detailedTsClientInfo);
I tried using ref
and out
for this object. However, everytime I get this error which says "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." and I am not able to get a work around for this.
(Attached an image which shows the error message)
Could anyone please help?
Thanks in advance!
[Edit-1]
Here is the exception which I am encountering.
c#
c#
edited Jan 1 at 19:51
Kalyana Srinivas
asked Jan 1 at 19:33
Kalyana SrinivasKalyana Srinivas
43
43
1
What you are witnessing are debugger anomalies. What is the actual problem you are experiencing in terms of your program itself.
– Kirk Woll
Jan 1 at 19:37
As the object is failing to initialize, my function fails to run and throws an exception with the same error message. Is there any way I can get around this?
– Kalyana Srinivas
Jan 1 at 19:39
I do not understand what you mean by "failing to initialize". Also, as that error message "Unable to evaluate expression" is entirely a debugger message, that is not the error that is causing an actual real exception for you.
– Kirk Woll
Jan 1 at 19:40
What exception do you get when you run it?
– CodingYoshi
Jan 1 at 19:43
1
Also, are you compiling under theDebug
configuration orRelease
? The latter impedes debugging.
– Kirk Woll
Jan 1 at 19:58
|
show 11 more comments
1
What you are witnessing are debugger anomalies. What is the actual problem you are experiencing in terms of your program itself.
– Kirk Woll
Jan 1 at 19:37
As the object is failing to initialize, my function fails to run and throws an exception with the same error message. Is there any way I can get around this?
– Kalyana Srinivas
Jan 1 at 19:39
I do not understand what you mean by "failing to initialize". Also, as that error message "Unable to evaluate expression" is entirely a debugger message, that is not the error that is causing an actual real exception for you.
– Kirk Woll
Jan 1 at 19:40
What exception do you get when you run it?
– CodingYoshi
Jan 1 at 19:43
1
Also, are you compiling under theDebug
configuration orRelease
? The latter impedes debugging.
– Kirk Woll
Jan 1 at 19:58
1
1
What you are witnessing are debugger anomalies. What is the actual problem you are experiencing in terms of your program itself.
– Kirk Woll
Jan 1 at 19:37
What you are witnessing are debugger anomalies. What is the actual problem you are experiencing in terms of your program itself.
– Kirk Woll
Jan 1 at 19:37
As the object is failing to initialize, my function fails to run and throws an exception with the same error message. Is there any way I can get around this?
– Kalyana Srinivas
Jan 1 at 19:39
As the object is failing to initialize, my function fails to run and throws an exception with the same error message. Is there any way I can get around this?
– Kalyana Srinivas
Jan 1 at 19:39
I do not understand what you mean by "failing to initialize". Also, as that error message "Unable to evaluate expression" is entirely a debugger message, that is not the error that is causing an actual real exception for you.
– Kirk Woll
Jan 1 at 19:40
I do not understand what you mean by "failing to initialize". Also, as that error message "Unable to evaluate expression" is entirely a debugger message, that is not the error that is causing an actual real exception for you.
– Kirk Woll
Jan 1 at 19:40
What exception do you get when you run it?
– CodingYoshi
Jan 1 at 19:43
What exception do you get when you run it?
– CodingYoshi
Jan 1 at 19:43
1
1
Also, are you compiling under the
Debug
configuration or Release
? The latter impedes debugging.– Kirk Woll
Jan 1 at 19:58
Also, are you compiling under the
Debug
configuration or Release
? The latter impedes debugging.– Kirk Woll
Jan 1 at 19:58
|
show 11 more comments
0
active
oldest
votes
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53998345%2fobject-when-passed-as-a-parameter-wont-initialize-in-c-sharp-and-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53998345%2fobject-when-passed-as-a-parameter-wont-initialize-in-c-sharp-and-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
What you are witnessing are debugger anomalies. What is the actual problem you are experiencing in terms of your program itself.
– Kirk Woll
Jan 1 at 19:37
As the object is failing to initialize, my function fails to run and throws an exception with the same error message. Is there any way I can get around this?
– Kalyana Srinivas
Jan 1 at 19:39
I do not understand what you mean by "failing to initialize". Also, as that error message "Unable to evaluate expression" is entirely a debugger message, that is not the error that is causing an actual real exception for you.
– Kirk Woll
Jan 1 at 19:40
What exception do you get when you run it?
– CodingYoshi
Jan 1 at 19:43
1
Also, are you compiling under the
Debug
configuration orRelease
? The latter impedes debugging.– Kirk Woll
Jan 1 at 19:58