Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How to extract function argument and return value through .NET profiler API ?

$
0
0

Through Profiler Api we can track the current methods and their performance. but can we do capture the function argument parameter and their return value as also?

Suppose below is a use case :

                               

  public void FatDateNow()
        {
            DateTime dt = DateTime.Now;
            HttpClient http = new HttpClient();
            http.BaseAddress = new Uri("http://dev-api-csplugin.crosscode.io");
            http.DefaultRequestHeaders.Accept.Clear();
            http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            AccountAPIInputParam input = new AccountAPIInputParam();
            input.AccountId = string.IsNullOrWhiteSpace(null) ? "d2b5ec99-8123-3d20-866a-3d7d203b5479" : null;
            var d = JsonConvert.SerializeObject(input);
            var content = new StringContent(d, Encoding.UTF8, "application/json");
            try
            {
                //http.Dispose();

                var output = http.PostAsync("api/v1.0/getAccountLibrary", new StringContent("test"));
                var url = output.Result.RequestMessage.RequestUri;

                //InterceptLib.DebugLogger.Log(http.BaseAddress + http.)
            }
            catch (Exception ex)
            {

            }

            System.Console.Write("AKS -DateTime.Now : ");
            System.Console.WriteLine(dt.ToString("HH:mm"));
        }

Above is C# method and now i want to capture url variable or  RequestUri from above method in run time. How can we do that ? Can we do through FunctionEnter/FunctionLeave api of profiler.If yes then please show me with some code snippet to achieve that. Thanks Ashuosh



Viewing all articles
Browse latest Browse all 1710

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>