Error "Bad message" when accessing a file on Windows OpenSSH SFTP server

I need to transfer large files via SFTP from a web site. I cannot store these files (even temporarily) on the web server so I am streaming the file in chunks to the SFTP server. I've installed OpenSSH (version 5_30_2016) on another Windows machine and am attempting to connect to it using SSH.NET (version 2016.0.0). This example code gives causes an exception to be thrown on my machine:const string PATH = "/D:/sftp/test.xml";var Client = new SftpClient("host", 22, "username", "password");Client.Connect(); if(!Client.Exists(PATH)){ var s = Client.C...

Can Silverlight OOB or WebHosted be built under x64 platform?

I made a test SL5 OOB project and tried to build under x64 platform but I get the warning: "Assembly generation -- Referenced assembly 'CommonLanguageRuntimeLibrary' targets a different processor".and an error:Error 2 Could not load file or assembly 'file:///C:\work\TestSilverlightOOB\TestSilverlightOOB\obj\x64\Debug\TestSilverlightOOB.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.Common.targets 214 9 TestSilverlightOOBSame for WebHost...

Is it possible to change the location of packages for NuGet?

I have the following convention for most of my projects:/src /Solution.sln /SolutionFolder /Project1 /Project2 /etc../lib /Moq moq.dll license.txt /Yui-Compressor yui.compressor.dll/tools /ILMerge ilmerge.exeYou'll notice that I do not keep external libraries inside the source folder. I'm also very interested in using NuGet but don't want these external libraries inside the source folder. Does NuGet have a setting to change the directory that all packages are loaded into? It's now possible to control which f...

What would cause ANY .NET application to crash immediately... except a project I create and Debug inside Visual Studio?

My software recently got deployed to a customer who said that the application was crashing immediately after it started. After some initial debugging, the customer provided me remote access to one of the computers which was unable to run the application. I found that the crash wasn't specific to my application. Any application which depended on the .NET framework crashed immediately. Conveniently, Visual Studio 2008 was installed so I created a quick hello world application on it and clicked Debug. The application worked fine. But, then when I tried to execute the gen...

.Net Standard 2.0 build fails on Teamcity

I am converting a project to the new .csproj format and setting it up to target both netstandard2.0 and net45. It's working fine on my machine, but somehow fails on our build server when trying to build for netstandard2.0. The build for net45 runs without errors. Part of the log: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin\Roslyn\csc.exe <lots of parameters>Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin\Roslynerror CS0234: The type or namespa...

.net - AccessViolation when interacting with native DLL for the first time

This is a little bit of a weird one, and my first foray into the world of .net so I'm hoping that I'm missing something fundamental :) Background:I have a native/Qt c++ DLL that I am wrapping for use in .NET, C# in this case. I have a Qt app that uses this DLL successfully, without memory leaks, etc. I have created a c++/CLI wrapper for this library and I can call into the native code through it successfully. However, I've noticed that depending on how I first interact with the managed DLL (and hence the native DLL), I see AccessViolation exceptions.If I allocate an obj...

What are 'closures' in .NET?

What is a closure? Do we have them in .NET?If they do exist in .NET, could you please provide a code snippet (preferably in C#) explaining it?EDIT: I went through Jon Skeet's article to understand what closures are and how to use them in .NET. I have an article on this very topic. (It has lots of examples.)In essence, a closure is a block of code which can be executed at a later time, but which maintains the environment in which it was first created - i.e. it can still use the local variables etc of the method which created it, even after that method has finished executi...

Why can't we write partial Functions?

Let us suppose that we have a Partial Class called Foo, like this:Partial Public Class Foo Partial Private Sub Bar(lorem As String) End Function Private Sub Bar(lorem As String) 'Do something End FunctionEnd ClassThis is a Class called Foo and has a Partial method. My question is: why is it illegal to use Partial Functions like this:Partial Public Class Foo Partial Private Function Bar(lorem As String) As Boolean End Sub Private Function Bar(lorem As String) As Boolean Return lorem.StartsWith("A") End SubEnd Class? If return values we...

How to clear WPF text box without updating its two-way bound source?

I have a Customer class which implements INotifyPropertyChanged. In my CustomerDetailsViewModel class, I have a property of type Customer. In the XAML, each text box is bound to each property of the Customer exposed by the my view model. I use TwoWay binding along with the PropertyChanged as UpdateSourceTrigger.Now I want to have a "Clear" button which will clear contents of all text boxes. Intent is to allow user to create a new Customer using another "Add" button. "Add" button must be enabled only when user enters the correct text. i.e. there should not be any validation ...

How to force uninstallation of windows service

I installed a windows service using installUtil.exe. After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first.When I now try to uninstall the service, installUtil.exe completes the uninstall successfully, but the service still appears. If I try to change its properties, I receive the message 'service is marked for deletion'. How can I force the deletion (preferrably w/o restarting the server)? One thing that has caught me out in the past is that if you have the services viewer running then that prevents the s...

Retargeting solution from .Net 4.0 to 4.5 - how to retarget the NuGet packages?

I have migrated a solution that is currently targeting .NET 4.0 in VS2010 to VS2012 and now I would like to re-target it to .Net 4.5What I am not sure about is the NuGet packages. For example EF5, which I updated from EF4 in VS2010 turns out to be actually EF 4.4 as you can see here: <Reference Include="EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll</HintPa...

Testing my NuGet package, "project cannot be viewed in the object browser" error with package but not with the comprising DLL

I am making a NuGet package which targets .Net Standard 1.3 and .Net Fx 4.5.To do this, I have a solution with my NetStandard version of the code, which is highly tested, and I copy across the two *.cs files to a duplicate project which targets Fx 4.5 - I didn't know a better way to do it. This is my first time targeting multiple frameworks.I then have a nuspec file which looks like this (metadata has been snipped for brevity):<?xml version="1.0"?><package> <metadata> <snip/> </metadata> <files> <file src="VillageSoftware.Path...

Getting a Crash Dump for a .NET Application that Uses Native Interop

I have a .NET application that makes calls to a native Win32 DLL using interop services. When I run this program, it will crash somewhere inside the DLL. However, I have been unable to get any stack dump information.When I run in the Visual Studio debugger, the debugger exits when the crash happens. I get the "Blah-blah-app has stopped working. Windows is checking for a solution to the problem...". If I click the Debug button that appears, I get an error message saying that the process is already open in a debugger, but the debugger from which I launched the app is not ...

Using related data stored in a 2 dimensional array

I am trying hard to understand arrays and read around the subject, but much of the literature is not easy to get your head around when you've only just started to program and there's no one you can ask to explain. This is my two dimensional array: 'Declare 2-diensional array of Strings Dim cars(,) As String = New String(,) {{"BMW", "Coupe", "Reg:2015", "5 Door"}, {"Ford", "Focus", "Reg:2015", "3 Door"}, {"Land Rover", "Discovery", "Reg:2014", "5 Door"}, {"Vauxhall", "Astra", "Reg:2014", "3 Door"}, {"SEAT", "Ibiza", "Reg:2...

Secure websocket (WSS) certificate signing

I have a website https://www.foo.com and on this site I connect to other machines with a websocket (some random ip address of a machine that has our software running on it). i.e. I connect to a websocket running on ws://123.45.67:80The problem is that this site is served over HTTPS and the websocket server that I want to connect to then also requires a secure connection (WSS) and won't work with a regular websocket (WS). The question is: how do I sign the certificate that will reside on each websocket server that is not on my domain? Can I use the certs from the main site h...

Making a WrapPanel respect his parent's width

Ok here's my code. Note that the StackPanel is directly in a UserControl.<StackPanel Orientation="Horizontal"> <ScrollViewer Width="450" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" > <Rectangle Width="400" Height="4000" Fill="BlanchedAlmond"></Rectangle> </ScrollViewer> <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" > <ItemsControl BorderBrush="Green" BorderThickness="2" ItemsSource="{Binding Path=MyOb...

Page 1 of 169  |  Show More Pages:  Top Prev Next Last