How to identify array type?

I have an OutOfMemoryException and I'd like to analyze the size and the type of the array which shall be created. I have created a demo purpose dump for that situation and I'm able to get the following information: 0:000> !pe Exception object: 023f389c Exception type: System.OutOfMemoryException Message: <none> InnerException: <none> StackTrace (generated): SP

如何识别数组类型?

我有一个OutOfMemoryException,我想分析应该创建的数组的大小和类型。 我为这种情况创建了一个演示目的转储,我可以获得以下信息: 0:000> !pe Exception object: 023f389c Exception type: System.OutOfMemoryException Message: <none> InnerException: <none> StackTrace (generated): SP IP Function 0015EE44 0099007F OOM2!OOM2.Program.Main()+0xf StackTraceString: <none>

What workflow framework to use in C#

I have to create a workflow in C# capable of moving an object (persisted as a database record) through an approval workflow where people are required to perform some sort of action or validation. We initially looked at Windows Workflow Foundation but shied away from it because it seemed so infrastructure-heavy (and besides we don't really like Microsoft products). We looked at ObjectFlow b

在C#中使用什么工作流框架

我必须在C#中创建一个工作流程,能够通过批准工作流程移动一个对象(作为数据库记录保存),人员需要执行某种操作或验证。 我们最初考虑的是Windows Workflow Foundation,但它避开它,因为它看起来如此基础设施很重(除此之外,我们并不真的喜欢微软的产品)。 我们考虑过ObjectFlow,因为它很轻量级,但我无法弄清楚如何坚​​持和恢复工作流程状态。 它几乎看起来太轻了。 有没有人有一个特别喜欢的工作流程框架? 我乐

Is using a strong named assembly for Plug In secure?

I was searching on way to prevent an unknown party from attaching their own Plug In containing malicious code into my application. And I ran across this post .NET Assembly Plugin Security It suggests to Strong Name the assembly and check it is strong named with the expected key on load. However, when I look at the MSDN documentation regarding Strong Named Assemblies at this site Strong-N

是否使用强大的命名组件来保护插件安全?

我正在寻找方法来防止未知方将他们自己的包含恶意代码的PlugIn插入到我的应用程序中。 我跑过这篇文章 .NET Assembly插件安全性 它向Strong Name建议程序集,并检查它是否以强加载的预期密钥命名。 但是,当我在本站查看有关强命名程序集的MSDN文档时 强大的组件 有一个警告说 不要依赖强名来保证安全。 他们只提供一个唯一的身份。 这是什么意思? 它们指的是什么安全性,这与我提供的上述堆栈溢出链接中的答

Secure Password Hashing

I need to store a hash of a single password in a .Net WinForms application. What's the most secure way to do this? In particular: Salt, HMAC, or both? How much salt? How many iterations? What encoding? (The password is plain ASCII) I assume that the algorithm should be either SHA512 or HMACSHA512. Salt your hash with secure random salt of at least 128bits or longer, to avoid

安全密码散列

我需要在.Net WinForms应用程序中存储单个密码的散列。 什么是最安全的方式来做到这一点? 尤其是: 盐,HMAC还是两者? 多少盐? 多少次迭代? 什么编码? (密码是纯ASCII) 我假设该算法应该是SHA512或HMACSHA512。 使用至少128位或更长的安全随机盐对您的散列进行清理,以避免彩虹攻击并使用BCrypt,PBKDF2或scrypt。 PBKDF2带有NIST认证。 引用:Archive.org:http://chargen.matasano.com/chargen/200

How to find out if the current application is an ASP.NET web app

From a managed class library, I'd like to find out whether the currently executing application is an ASP.NET web application (web forms or MVC) or not. I have seen different approaches to do so, eg by checking one of the following: System.Web.Hosting.HostingEnvironment.IsHosted == true System.Web.HttpContext.Current != null System.Web.HttpRuntime.AppDomainAppId != null System.Web.Ht

如何找出当前的应用程序是否是ASP.NET Web应用程序

从托管类库中,我想知道当前正在执行的应用程序是否是ASP.NET Web应用程序(Web窗体或MVC)。 我看到了不同的方法来做到这一点,例如通过选择以下选项之一: System.Web.Hosting.HostingEnvironment.IsHosted == true System.Web.HttpContext.Current != null System.Web.HttpRuntime.AppDomainAppId != null System.Web.HttpRuntime.Cache != null 检查一个web.config文件(注意:我不认为这是可靠的) 问题是我

How can I get my webapp's base URL in ASP.NET MVC?

How can I quickly determine what the root URL is for my ASP.NET MVC application? Ie, if IIS is set to serve my application at http://example.com/foo/bar, then I'd like to be able to get that URL in a reliable way that doesn't involve getting the current URL from the request and chopping it up in some fragile way that breaks if I re-route my action. The reason that I need the base URL i

如何在ASP.NET MVC中获取我的webapp的基本URL?

我如何快速确定我的ASP.NET MVC应用程序的根URL是什么? 也就是说,如果IIS设置为在http://example.com/foo/bar上为我的应用程序提供服务,那么我希望能够以可靠的方式获取该URL,而不涉及从当前URL请求并以某种脆弱的方式将其切碎,如果我重新布置我的动作,就会中断。 我需要基本URL的原因是,此Web应用程序调用另一个需要根用于调用者Web应用程序的回调用途。 假设你有一个Request对象可用,你可以使用: string.Format(

How do you unit test private methods?

I'm building a class library that will have some public & private methods. I want to be able to unit test the private methods (mostly while developing, but also it could be useful for future refactoring). What is the correct way to do this? 如果您使用.net,则应使用InternalsVisibleToAttribute。 If you want to unit test a private method, something may be wrong. Unit tests are (general

你如何测试私有方法?

我正在建立一个拥有一些公共和私人方法的类库。 我希望能够对私有方法进行单元测试(主要是在开发过程中,但对未来的重构可能也有用)。 什么是正确的方法来做到这一点? 如果您使用.net,则应使用InternalsVisibleToAttribute。 如果你想单元测试一个私有方法,可能是错误的。 单元测试(一般来说)意味着测试一个类的接口,这意味着它的公共(和受保护的)方法。 你当然可以“解决”这个问题(即使只是公开方法),但你也

Calculation result is different depending on decimal or double

This question already has an answer here: Difference between decimal, float and double in .NET? 17 answers Doubles are not an exact representation: there is a lot of rounding and truncation (but you do get a much greater range). Reading: What Every Computer Scientist Should Know About Floating-Point Arithmetic.

计算结果因小数或双倍而不同

这个问题在这里已经有了答案: .NET中decimal,float和double的区别? 17个答案 双打并不是一个确切的表示:有很多舍入和截断(但你得到更大的范围)。 阅读:每位计算机科学家应该知道什么是浮点运算。

Removing XElements in a foreach loop

So, I have a bug to remove foreach (XElement x in items.Elements("x")) { XElement result = webservice.method(x); if (/*condition based on values in result*/) { x.Remove(); } } The problem is that calling x.Remove() alters the foreach such that if there are two Elements("x"), and the first is removed, the loop doesn't get to the second x element. So how

在foreach循环中删除XElements

所以,我有一个要删除的错误 foreach (XElement x in items.Elements("x")) { XElement result = webservice.method(x); if (/*condition based on values in result*/) { x.Remove(); } } 问题是调用x.Remove()会改变foreach,如果有两个元素(“x”),并且第一个被移除,则循环不会到达第二个x元素。 那么我应该怎样循环呢? 还是应该以另一种方式重写? 我怀疑Linq可能能够在这里帮助你,

Use full .NET Framework with existing ASP.NET Core project

We have an ASP.NET Core web application currently running on .NET Core, which now needs to reference internal libraries which were built for and will only run on the full .NET Framework. As per the documentation: ASP.NET Core apps can run on .NET Core or on the full .NET Framework. ...What steps are needed to change an existing ASP.NET Core project to run on the full .NET Framework? I can

在现有的ASP.NET Core项目中使用完整的.NET Framework

我们有一个当前在.NET Core上运行的ASP.NET Core Web应用程序,该应用程序现在需要引用内部库,这些库是为完整的.NET Framework而构建的,并且只能在完整的.NET Framework上运行。 根据文件: ASP.NET Core应用程序可以在.NET Core或完整的.NET Framework上运行。 ...需要哪些步骤来更改现有的ASP.NET Core项目以在完整的.NET Framework上运行? 我似乎无法在文档或Visual Studio工具中找到.NET Core和完整.NET Framewor