Skip to main content

SharpDetect: Dynamic Analysis Framework for C#/.NET Programs

  • Conference paper
  • First Online:
Runtime Verification (RV 2020)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 12399))

Included in the following conference series:

Abstract

Dynamic analysis is a popular approach to detecting possible runtime errors in software and for monitoring program behavior, which is based on precise inspection of a single execution trace. It has already proved to be useful especially in the case of multithreaded programs and concurrency errors, such as race conditions. Nevertheless, usage of dynamic analysis requires good tool support, e.g. for program code instrumentation and recording important events. While there exist several dynamic analysis frameworks for Java and C/C++ programs, including RoadRunner, DiSL and Valgrind, we were not aware of any framework targeting the C# language and the .NET platform. Therefore, we present SharpDetect, a new framework for dynamic analysis of .NET programs — that is, however, focused mainly on programs compiled from the source code written in C#. We describe the overall architecture of SharpDetect, the main analysis procedure, selected interesting technical details, its basic usage via command-line, configuration options, and the interface for custom analysis plugins. In addition, we discuss performance overhead of SharpDetect based on experiments with small benchmarks, and demonstrate its practical usefulness through a case study that involves application on NetMQ, a C# implementation of the ZeroMQ messaging middleware, where SharpDetect found one real concurrency error.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Cizmarik, A.: Dynamic Analysis Framework for C#/.NET Programs. Master thesis, Charles University, Prague, (2020) https://is.cuni.cz/webapps/zzp/detail/209472/45410198

  2. Flanagan, C., Freund, S.N.: FastTrack: efficient and precise dynamic race detection. In Proceedings of PLDI 2009, pp. 121–133. ACM (2009) https://doi.org/10.1145/1542476.1542490

  3. Flanagan, C., Freund, S.N.: The RoadRunner dynamic analysis framework for concurrent programs. In Proceedings of PASTE 2010, pp. 1–8. ACM (2010) https://doi.org/10.1145/1806672.1806674

  4. Marek, L., et al.: Java bytecode instrumentation made easy: the DiSL framework for dynamic program analysis. In: Jhala, R., Igarashi, A. (eds.) APLAS 2012. LNCS, vol. 7705, pp. 256–263. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-35182-2_18

    Chapter  Google Scholar 

  5. Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. In Proceedings of PLDI 2007, pp. 89–100. ACM (2007) https://doi.org/10.1145/1250734.1250746

  6. Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., Anderson, T.: Eraser: a dynamic data race detector for multithreaded programs. ACM Trans. Comput. Syst. (TOCS) 15(4), 391–411 (1997). https://doi.org/10.1145/265924.265927

    Article  Google Scholar 

  7. Serebryany, K., Iskhodzhanov, T.: ThreadSanitizer: data race detection in practice. In Proceedings of WBIA 2009, pp. 62–71. ACM (2009) https://doi.org/10.1145/1791194.1791203

  8. Dnlib, https://github.com/0xd4d/dnlib. Accessed Jun 2020

  9. The NetMQ library, https://netmq.readthedocs.io/en/latest/. Accessed Jun 2020

  10. NetMQ Custom Clock Implementation, https://github.com/zeromq/netmq/blob/e4dfcf9e8190f85bf4fab9fc657e2c7da820c7f4/src/NetMQ/Core/Utils/Clock.cs#L88. Accessed Jun 2020

  11. .NET Profiling API Reference, https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/. Accessed Jun 2020

  12. A complete list of supported Runtime Identifiers (RID), https://docs.microsoft.com/en-us/dotnet/core/rid-catalog. Accessed Jun 2020

Download references

Acknowledgments

This work was partially supported by the Czech Science Foundation project 18-17403S and partially supported by the Charles University institutional funding project SVV 260588.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Pavel Parízek .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Čižmárik, A., Parízek, P. (2020). SharpDetect: Dynamic Analysis Framework for C#/.NET Programs. In: Deshmukh, J., Ničković, D. (eds) Runtime Verification. RV 2020. Lecture Notes in Computer Science(), vol 12399. Springer, Cham. https://doi.org/10.1007/978-3-030-60508-7_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-60508-7_16

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-60507-0

  • Online ISBN: 978-3-030-60508-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics