参数字典包含非可空类型'System.Int32'的参数'appId'的空条目,用于'HLIT_TicketingMVC.Controllers.TicketController'中的方法'System.Web.Mvc.ContentResult CheckForInstaller(Int32)'.可选参数必须是引用类型,可空类型,或者声明为可选参数.
function SubmitAjax(url, message, successFunc, errorFunc) {
$.ajax({
type:'POST',
url:url,
data:message,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success:successFunc,
error:errorFunc
});
};
Run Code Online (Sandbox Code Playgroud)
数据对象构建如下:
var message={"appId":application.val()};
Run Code Online (Sandbox Code Playgroud)
我也尝试了一个jsonified字符串:
var message="{'appId':"+application.val()+"}";
Run Code Online (Sandbox Code Playgroud)
和
var message="{'appId':'"+application.val()+"'}";
Run Code Online (Sandbox Code Playgroud)
我在尝试发布之前验证了消息是否带有正确的int值.鼠标在调试器上最近显示:{appId="6"}
控制器上的方法签名是:
public ContentResult CheckForInstaller(int appId)
Run Code Online (Sandbox Code Playgroud)
当我从方法签名中删除参数时,它确实触及了内部的断点,所以它是需要某种属性的签名,或者我认为消息没有正确构建.
我在控制器上有2个动作:
public class CalculatorsController : Controller
{
//
// GET: /Calculators/
public ActionResult Index()
{
return RedirectToAction("Accounting");
}
public ActionResult Accounting()
{
var combatants = Models.Persistence.InMemoryCombatantPersistence.GetCombatants();
Debug.Assert(combatants != null);
var bvm = new BalanceViewModel(combatants);
Debug.Assert(bvm!=null);
Debug.Assert(bvm.Combatants != null);
return View(bvm);
}
}
Run Code Online (Sandbox Code Playgroud)
调用Index方法时,我会得到一个null模型.当通过它的url直接调用Accounting方法时,我会得到一个水合模型.
我有一个方便的Visual Studio外部工具快捷方式,可以在启用MvcBuildViews的情况下构建当前项目。
参数:/m:2 $(ProjectFileName) /p:MvcBuildViews=true
命令行:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /m:2 "ProviderPortal.csproj" /p:MvcBuildViews=true
每当视图上有错误时,它都会在该视图处停止并报告该错误。我想知道所有有错误的视图不仅会停在第一个视图。
我该如何告诉Aspnet-Compiler继续出现错误?还是有办法让msbuild代替每个视图调用aspnet-compiler,而不是一次调用?
我试图找到一个简单的解决方案,而不是手动工作来引用包.在.fsx文件中.
LinqPad 4 让我简单地添加nuget包
LinqPad 5 beta 让我添加nuget包
VS2015 不允许您下载/安装fsx文件的包(仅限于项目)VSCode 不允许您下载/安装fsx文件的nuget或paket包.所以我最终不得不在VS2015中使用.fsx,同时使用linqpad来获取下载的软件包(对于像templatus这样下载exe而不是dll的软件包仍然会失败).然后我可以将它们作为参考
#I @"..\LINQPad\NuGet.FW46\FParsec\FParsec.1.0.2\lib\net40-client\" // references AppData\local\ ... since . is %localappdata%\TEMP
Run Code Online (Sandbox Code Playgroud)
我不想创建一个项目.我有大量单独的脚本,可以由其他人按需单独维护和使用.
是否有一个IDE(或其中一个的修复/扩展)可以为F#.fsx文件提供智能感知,自动完成和包管理,这些文件可以轻松地从用户到用户,从机器到机器工作?
来自原始数据类型(int,char等)的内存是在它们离开作用域后立即释放,还是添加到垃圾收集中以供以后发布?
考虑:
For x as integer=0 to 1000
dim y as integer
Next
Run Code Online (Sandbox Code Playgroud)
如果这不会将垃圾收集器中的1000个整数添加到以后清理,它如何处理字符串对象?这会创建1000个字符串以便以后清理吗?
For x as integer=0 to 1000
dim y as string=""
Next
Run Code Online (Sandbox Code Playgroud)
如何只包含int,string等...数据类型的结构?
仅包含托管资源的类?
.net performance garbage-collection memory-leaks memory-management
我有以下继承:
internal abstract class TeraRow{}
internal class xRow : TeraRow {} // xRow is a child of TeraRow
public IEnumerable<TeraRow> Compare(MappedTables which, DateTime selectionStart
, DateTime selectionEnd, string pwd)
{
IEnumerable<xRow> result=CompareX();
return (IEnumerable<TeraRow>)result; //Invalid Cast Exception?
}
Run Code Online (Sandbox Code Playgroud)
无法转换'System.Collections.Generic.List 1[xRow]' to type 'System.Collections.Generic.IEnumerable1 [TeraRow] 类型的对象
另外,为什么我需要施放它?
我听说单元测试的一个原因是你可以在一分钟左右的时间内运行2000多个测试..因为唯一的限制是CPU速度和内存.但是,我喜欢在我的测试项目中包含外部依赖性断言/测试(例如:应用程序登录的用户帐户是否对相应的表具有插入/更新/删除权限,以便考虑是否迁移了数据库?)
有没有一个框架或支持的方式来利用MS测试,你可以选择只运行单元测试或只是集成测试,或者只需点击一下按钮?
运用 System.Web.Script.Serialization.JavaScriptSerializer
我可以以某种方式反序列化为不可变对象吗?
public class Item
{
public Uri ImageUri { get;private set; }
public string Name { get; private set; }
public Uri ItemPage { get;private set; }
public decimal Retail { get;private set; }
public int? Stock { get; private set; }
public decimal Price { get; private set; }
public Item(Uri imageUri, string name, Uri itemPage, decimal retail, int? stock, decimal price)
{
ImageUri = imageUri;
Name = name;
ItemPage = itemPage;
Retail = retail;
Stock = …Run Code Online (Sandbox Code Playgroud) type ProcessParametersPair = {Definition:string; Provided:string}
type QueryResult = { DefinitionId:int;DefinitionName:string; ProcessTemplateId:int; StatusName:string; DefinitionArgs:string; BuildArgs:string;
StatusCode:int option;cleanWorkspaceOption:string; RawProcessParameters:ProcessParametersPair; lastBuild:Tbl_Build}
type QueryDisplay = { DefinitionId:int;DefinitionName:string; ProcessTemplateId:int; StatusName:Object; DefinitionArgs:string; BuildArgs:string;
StatusCode:int option;cleanWorkspaceOption:string; RawProcessParameters:Object; lastBuild:Object}
Run Code Online (Sandbox Code Playgroud)
我真的必须重复匹配的QueryDisplayRecord的所有字段吗?我可以像记录实例那样做吗?type QueryDisplay = {QueryResult with lastBuild:Object}
在这种情况下,我根据字段类型改变记录,我也很想知道我是否可以这样做但是在添加的字段而不是类型更改字段.
我不是指实例,我指的是记录类型定义.
这些都可能吗?
.net ×3
asp.net-mvc ×3
c# ×2
f# ×2
casting ×1
f#-scripting ×1
generics ×1
ienumerable ×1
immutability ×1
jquery ×1
json ×1
memory-leaks ×1
msbuild ×1
msbuild-4.0 ×1
performance ×1
pinvoke ×1
unit-testing ×1
winforms ×1
wpf ×1