When release dlls don't work but debug dlls do

前端 未结 15 1366
我寻月下人不归
我寻月下人不归 2020-12-30 03:14

After deploying our huge distributed system to one of our clients we experience an unexpected error. During the investigation we replace the assembly causing the error with

15条回答
  •  轮回少年
    2020-12-30 04:02

    Had the same issue with a C# DLL containing a WCF client provided for multiple client applications.

    Found out there was a method in the C# client library accessing the StackTrace for logging purposes, which happens to be different when compiled in debug.

    StackTrace stackTrace = new StackTrace();
    MethodBase methodBase = stackTrace.GetFrame(2).GetMethod();
    

    GetFrame(2) didn't existed in release. More info about that can be found here: StackTrace class methods not working in release mode

    Funny thing is a VB.NET client was affected while in another C#.NET client it worked properly.

    Hope it helps.

提交回复
热议问题