.NET应用程序的故障注入? [英] Fault injection for .NET apps?

查看:103
本文介绍了.NET应用程序的故障注入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人知道将常见故障自动注入正在运行的.NET程序的工具或技术。像这样的东西...

I am wondering if anyone knows of tools or techniques to automatically inject common faults into a running .NET program. Stuff like...


  • 在分配时随机注入OutOfMemoryException

  • 在尝试随机注入FileNotFoundException访问文件

  • 使用套接字随机注入IO或网络异常。

我真的在寻找一种方法来拦截CLR中的某些特定调用,类似于AppVerifier对本地Win32代码所做的操作。目的是在开发人员无法控制的许多错误情况下测试应用程序,并确保可以处理此类情况。

So I'm really looking for a way to intercept some specific calls in the CLR similar to what AppVerifier does for native Win32 code. The purpose is to test apps under lots of error conditions beyond the developers control and to make sure such conditions are handled.

推荐答案

有是一个名为 TestAPI 的Codeplex项目,可以执行运行时错误注入。您需要查看其 托管代码错误注入API 。它使用 CLR分析API 来在运行时拦截方法调用并修改其行为。

There is a codeplex project called TestAPI that can do runtime fault injection. You need to look at its managed code fault injection API. It uses the CLR profiling API to intercept method calls at runtime and modify their behaviour.

看看一个示例,以查看如何在已编译的exe中的方法调用上注入异常。

Have a look at an example to see how to inject an exception on a method call in an already compiled exe.

这篇关于.NET应用程序的故障注入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆