我有以下功能:
private void emailVideoButton_Click(object sender, EventArgs e)
{
VideoEMailForm emailForm = new VideoEMailForm();
emailForm.ShowDialog();
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下警告:
警告1 CA2000:Microsoft.Reliability:在方法'VideoPlayerControl.emailVideoButton_Click(object,EventArgs)'中,在对所有引用超出范围之前,在对象'emailForm'上调用System.IDisposable.Dispose.
我读了这个链接http://msdn.microsoft.com/en-us/library/ms182289(v=vs.80).aspx并收集了我需要调用.像这样的消息:
private void emailVideoButton_Click(object sender, EventArgs e)
{
VideoEMailForm emailForm = new VideoEMailForm();
emailForm.ShowDialog();
emailForm.Dispose();
}
Run Code Online (Sandbox Code Playgroud)
但后来我收到以下警告:
警告1 CA2000:Microsoft.Reliability:在方法"VideoPlayerControl.emailVideoButton_Click(object,EventArgs)"中,对象"emailForm"未沿所有异常路径放置.在对所有引用超出范围之前,调用System.IDisposable.Dispose对象'emailForm'.
任何人都可以帮我摆脱这个警告吗?
我想从当前位置获取一个文件夹的路径,该文件夹是2个目录.
我正在做以下事情:
echo %CD%
set NEW_PATH = ..\..\bin\
echo %PATH%
Run Code Online (Sandbox Code Playgroud)
当我运行上面的命令时,我打印了当前的目录路径但是NEW_PATH不是..它只是说ECHO_OFF.
从这个链接:批处理文件:相对路径错误,从我也尝试过的当前目录向上一级
set NEW_PATH = %~dp0..\..\bin\
Run Code Online (Sandbox Code Playgroud)
但仍然是同样的问题.
我怎样才能获得此目录路径?
我在ASP.NET C#网络应用程序中使用了YouTube API,并使用以下示例将视频上传到我的个人YouTube帐户:
https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video
我正在上传一个10MB的mp4文件,大小为30MB.
如果我没有对配置文件进行任何更改,API会报告" 任务已取消 "并在几分钟后停止上传.
谷歌搜索后发现我不得不减少块大小并增加超时和mak上传大小.
所以我然后将块大小更改为以下内容:
videosInsertRequest.ChunkSize = 256 * 1024;
Run Code Online (Sandbox Code Playgroud)
并将followig添加到我的Web.config文件中:
<system.webServer>
<security >
<requestFiltering>
<requestLimits maxAllowedContentLength="1024000000" />
</requestFiltering>
</security >
Run Code Online (Sandbox Code Playgroud)
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="104857600" executionTimeout="36000" />
</system.web>
Run Code Online (Sandbox Code Playgroud)
然后,这允许我上传完整的文件,而不会失败:)
但是在调试我的Web应用程序时(从我的PC上的Visual Studio),上传需要18分钟.如果我通过YouTubes自己的网站上传相同的文件,则只需4分钟.
我可以对配置设置进行哪些更改,以使上传时间与YouTube上传时间相当?
编辑: 我注意到,如果我没有将chunksize设置为任何值,它的上传速度为aprox 1Mb/s,应该足够快但在2-3分钟后失败.
如何将超时设置为上述代码示例的最大值?
我有一个 C++ dll,我将其称为 Dll A,其中我使用过:
#include <mutex>
Run Code Online (Sandbox Code Playgroud)
Dll As 属性设置为“无公共语言运行时支持”并且构建成功。
我有另一个 Dll B,其引用中包含 DLL A。Dll B 属性设置为:“公共语言运行时支持 (/clr)”,因为它包含 C++/CLI 代码。
当我构建 DLL BI 时出现错误: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\mutex(8): fatal error C1189: #error : 使用 /clr 编译时不支持 <mutex>或/clr:纯。
我知道我不能包含在 CLR 支持的 DLL 中,但是有没有办法可以解决引用包含它的 DLL 的问题?
我在 .NET 应用程序中卸载 AppDomain 时遇到问题。
我有以下代码,它只是将 dll 加载到目录中并检查它们是否具有特定属性:
AppDomainSetup info = new AppDomainSetup();
Assembly arAssembly = typeof(AssemblyResolver).Assembly;
info.ApplicationBase = Path.GetDirectoryName(arAssembly.Location);
AppDomain appDomain = AppDomain.CreateDomain("AssemblyResolver", null, info);
//Find all the assemblies with the attribute defined
AssemblyName[] assemblyNames = null;
AssemblyResolver ar = (AssemblyResolver)appDomain.CreateInstanceAndUnwrap(arAssembly.FullName, typeof(AssemblyResolver).FullName) as AssemblyResolver;
assemblyNames = ar.PrivateFindAssembliesWithAttribute(attributeType, path, includeSubdirs);
//Finally unload the AppDomain
AppDomain.Unload(appDomain); <-- HANGS HERE
appDomain = null;
Run Code Online (Sandbox Code Playgroud)
这对于我所有具有相关属性的 dll 来说效果很好。但我有一个 dll,其中包含对第 3 方 dll 的引用(PelcoSDK.dll,请参阅:http ://pdn.pelco.com/sdk#sthash.ERuOPMO6.dpbs )
每当包含此 dll 时,以下行就会冻结:
AppDomain.Unload(appDomain);
Run Code Online (Sandbox Code Playgroud)
通过此链接: https: //social.msdn.microsoft.com/Forums/en-US/3f0f10ae-7fcb-459d-9112-6556a9b5b456/appdomainunload-deadlock ?forum=csharplanguage …
我打开了一个在xCode 9中使用Lua的IOS Objetive C项目(该版本在xCode 8中运行),并且出现以下错误:
'system' is unavailable: not available in iOS
Run Code Online (Sandbox Code Playgroud)
我知道iOS11中不存在“系统”,但是如何使用Lua修复此问题?这是我包含的库,不是我自己写的。
我正在使用 python3 并使用以下方法安装了 tensorflow-gpu:
pip3 install tensorflow-gpu==1.13.1
Run Code Online (Sandbox Code Playgroud)
并已检查它是否已通过以下方式安装:
pip3 show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.13.1
Summary: TensorFlow is an open source machine learning framework for
everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/lib64/python3.6/site-packages
Requires: tensorflow-estimator, keras-applications, termcolor, absl-py, six,
astor, protobuf, wheel, keras-preprocessing, gast, grpcio, numpy,
tensorboard
Required-by:
Run Code Online (Sandbox Code Playgroud)
但是当我执行以下操作时,它给了我一个错误:
user:/home/mydirectory # python3
Python 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback …Run Code Online (Sandbox Code Playgroud) 我在一台服务器上安装了 pycharm,在另一台服务器上安装了 docker。
我希望将 PyCHarm 连接到另一台服务器上的 docker。
我已经添加了服务器的IP地址和用户名和密码,但测试连接失败。
我到底应该在 PyCharm 的配置屏幕中输入什么?我需要使用特定的地址格式吗?
我按照以下说明创建了一个多项目 Visual Studio Temploate: http://msdn.microsoft.com/en-us/library/ms185308.aspx。
这工作正常,当我从“文件”-->“新建项目”选项中选择项目模板时,我可以在 Visual Studio 中看到我的两个项目。

现在我想添加另外两个项目,但我现在希望这些项目出现在不同的文件夹下,如下所示:

如何修改 .vstemplate 文件以使解决方案文件夹出现?我从此链接将解决方案文件夹添加到 Visual Studio 项目模板中看到,我应该使用向导(http://msdn.microsoft.com/en-us/library/ms185301.aspx),但我真的不知道如何使用它只需创建两个文件夹。感谢所有帮助。
编辑 我遵循了这个示例http://msdn.microsoft.com/en-us/library/ms185301.aspx,我现在可以通过执行以下操作将文件夹添加到我的项目中:
_DTE _dte;
Solution2 _solution;
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
{
_dte = automationObject as _DTE;
}
public void RunFinished()
{
_solution = (Solution2)_dte.Solution;
_solution.AddSolutionFolder("MyFolder1");
_solution.AddSolutionFolder("MyFolder2");
}
Run Code Online (Sandbox Code Playgroud)
但我想做的是将我的项目添加到文件夹下。他们目前只是出现在顶部。我该怎么做呢?
我有一个 c# 应用程序 A,它启动另一个 c# 应用程序 B,如下所示:
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
string path = baseDir + "Programs\\Logging\\";
Process logger = new Process();
logger.StartInfo.FileName = System.IO.Path.Combine(path, "Logger.exe");
logger.Start();
Run Code Online (Sandbox Code Playgroud)
在 Logger.exe 中,我执行以下操作:
string dir = Directory.GetCurrentDirectory();
Run Code Online (Sandbox Code Playgroud)
但它告诉我 dir 是启动它的原始程序 A 的目录,而不是它自己的目录(Programs\Logging)
为什么是这样??
c# ×5
.net ×4
appdomain ×1
asp.net ×1
batch-file ×1
c++-cli ×1
clr ×1
docker ×1
file-upload ×1
ios ×1
linux ×1
lua ×1
opensuse ×1
path ×1
pip ×1
pycharm ×1
python ×1
python-3.x ×1
tensorflow ×1
winforms ×1
xcode ×1
youtube-api ×1