草庐IT

argumentException

全部标签

c# - ArgumentException - 在异步中对事件 TaskScheduled 使用未定义的关键字值 1

获取System.ArgumentException-在异步API中为事件TaskScheduled使用未定义的关键字值1。在使用VisualStudio2013Update3的通用应用程序中运行第一个await语句时出现问题。我在安装VisualStudio2013Update3后使用WP8.1Universal和silverlight应用程序。异常发生在模拟器/设备模式中。我花了几天时间研究这个问题,但没有任何解决办法。我在Windows开发中心论坛上有一篇同级文章,但我还没有听到Microsoft的任何答复。代码很简单。一旦抛出内部异常,await将永远不会返回。还有其他人遇到这

c# - 在 Nunit 中验证 ArgumentException 及其消息,C#

在我的Nunit测试程序中,我想通过验证消息来验证它是否正在获取写入参数异常。[Test]publicvoidArgumentsWorkbookNameException(){conststringworkbookName="Tester.xls";varargs=new[]{workbookName,"Sheet1","Source3.csv","Sheet2","Source4.csv"};Assert.Throws(typeof(ArgumentException),delegate{varappargs=newApplicationArguments(args);},"Inva

c# - HttpWebRequest:将 Cookie 添加到 CookieContainer -> ArgumentException(参数名称:cookie.Domain)

我正在尝试通过我的应用程序登录网站。我做了什么:首先,我了解了浏览器如何使用Fiddler执行授权过程。我检查了POST请求是如何构建的,并尝试重建它。浏览器发送4个cookie(GoogleAnalytics),我尝试设置它们:CookieContainergaCookies=newCookieContainer();gaCookies.Add(newCookie("__utma","#########.###########.##########.##########.##########.#"));gaCookies.Add(newCookie("__utmb","#######

c# - Marshal.SizeOf 在枚举上抛出 ArgumentException

考虑这段代码:publicenumMyEnum{V1,V2,V3}intsize=Marshal.SizeOf(typeof(MyEnum));它抛出异常:Anunhandledexceptionoftype'System.ArgumentException'occurredinTestConsole.exeAdditionalinformation:Type'TestConsole.Program+MyEnum'cannotbemarshaledasanunmanagedstructure;nomeaningfulsizeoroffsetcanbecomputed.虽然这段代码没有抛