小编Gus*_*oTM的帖子

MVC Scaffolding错误:"值不能为null.参数名称:source"

我按照这篇文章中的说明进行操作,但是当我尝试添加产品时,我收到此错误:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Value cannot be null.
Parameter name: source 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: source

Source Error: 


Line 63: </div>
Line 64: <div class="editor-field">
Line 65:     @Html.DropDownListFor(model => model.CategoryId, ((IEnumerable<GAM.Models.Category>)ViewBag.PossibleCategories).Select(option => new SelectListItem {
Line 66:         Text = …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc scaffolding html.dropdownlistfor asp.net-mvc-3

5
推荐指数
1
解决办法
7231
查看次数

从 FileStream 获取文件描述符句柄

我正在使用这个库https://github.com/ahawker/NLibsndfile使用来自 C# 的 libSndFile 转换音频文件,我做了这个方法,用于转换(转换 wav 到 aiff):

        string sourcePath = "/User/Dev/Desktop/a.wav";
        string targetPath = "/User/Dev/Desktop/b.aiff";

        var file = File.Create(targetPath);
        file.Close();
        file.Dispose();
        IntPtr ptrTargetFile = file.SafeFileHandle.DangerousGetHandle();

        LibsndfileInfo wavInfo = new LibsndfileInfo();
        LibsndfileInfo aiffInfo = new LibsndfileInfo();
        LibsndfileApi api = new LibsndfileApi();

        var wavFile = api.Open(sourcePath, LibsndfileMode.Read, ref wavInfo);
        var aiffFile = api.OpenFileDescriptor((int)ptrTargetFile, LibsndfileMode.Rdwr, ref aiffInfo, 0);

        aiffInfo.Channels = wavInfo.Channels;
        aiffInfo.SampleRate = wavInfo.SampleRate;
        aiffInfo.Format = LibsndfileFormat.Aiff;

        short[] buffer = new short[512];

        long countOfItemsWritten = 0;
        long countOfItemsReaded = 0; …
Run Code Online (Sandbox Code Playgroud)

c# mono monomac

5
推荐指数
1
解决办法
3550
查看次数