none
AppDomain.DoCallBack() with multi generic types issue. Bug? RRS feed

  • Question

  • i've a strange issue with AppDomain.DoCallBack() and generic types:

    static void InvokeIsolated() {
      AppDomain appDomain = AppDomain.CreateDomain("testDomain");
      appDomain.DoCallBack(MyDoCallBack<string, string>); //<-- ArgumentNullException!
    }
    static void MyDoCallBack<T, T1>() {}

    i get an argumentnullexpcetion with the message: "value cannot be null" when the generic types are the same.

    if i change the docallback to this:

    appDomain.DoCallBack(MyDoCallBack<string, int>); //<-- OK!

    that means if the generic types are different, there is no problem.

    what is wrong or is this a .net bug??


    • Edited by sghamari Sunday, February 15, 2015 12:50 PM
    Sunday, February 15, 2015 12:44 PM

Answers

  • Hello sghamari,

    With your provided code, after testing it, I reproduced this scenario, however, when using the lambda expression, it could works,(also test for other types, it seems that if type is same, this issue is thrown)

    appDomain.DoCallBack(() => MyDoCallBack<char, char>());

    For this issues, my suggestion that you could check this blog to debug to the .NET source code and you could focus on the MakeGenericMethod in mscorlib dll and you could post this feedback to the .NET team on this site:

    https://connect.microsoft.com/VisualStudio/Feedback

    Currently, you could use the lambda expression.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, February 16, 2015 7:43 AM
    Moderator

All replies

  • Hello sghamari,

    With your provided code, after testing it, I reproduced this scenario, however, when using the lambda expression, it could works,(also test for other types, it seems that if type is same, this issue is thrown)

    appDomain.DoCallBack(() => MyDoCallBack<char, char>());

    For this issues, my suggestion that you could check this blog to debug to the .NET source code and you could focus on the MakeGenericMethod in mscorlib dll and you could post this feedback to the .NET team on this site:

    https://connect.microsoft.com/VisualStudio/Feedback

    Currently, you could use the lambda expression.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, February 16, 2015 7:43 AM
    Moderator
  • Thanks for your answer but there is another problem with lambda expression:

    lambda call with types

    appDomain.DoCallBack(() => MyDoCallBack<char, char>()); <-this should works

    lambda call with generic types

    appDomain.DoCallBack(() => MyDoCallBack<T, T1>()); <- this should not works

    Tuesday, February 17, 2015 11:46 AM
  • Hello,

    For this scenario, you could also include it in your feedback and post it to the site I provided above.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 18, 2015 7:28 AM
    Moderator