Posts

Showing posts from February, 2017

Visual Studio 2010 Code Snippets fail on VS 2015 with "Object reference not set to an instance of an object"

Image
We've recently had a problem with some old Visual Studio 2010 code snippets written in C# failing when used in Visual Studio 2015 with an "Object reference not set to an instance of an object" error. It appears that the code snippets now require the title value to be set. < CodeSnippet Format = " 1.0.0 " >   < Header >     < Title > Add collection editor attribute </ Title >     < Shortcut > coledit </ Shortcut >   </ Header >   < Snippet >     < Code Language = " csharp " >       <![CDATA[ [Editor(typeof(AdvancedCollectionEditor), typeof(UITypeEditor))] ]]>     </ Code >   </ Snippet > </ CodeSnippet > Setting the title will immediately remedy the issue, but another gotcha is.... Any code snippet in the document missing the title element will cause subsequent code snippets to fail.

Using PowerShell New-WebServiceProxy to access Web Services with Client Certificate Authentication

We've recently been looking into helping our customers implement two factor authentication with client certificates. This was going very well, until writing the help to consume our ASP.NET soap web services with a client certificate. Here's the problem... It seems that the New-WebServiceProxy cmdlet does not support passing client certificates when it generates the compiled WSDL. $uri = "https://centrel-ws02/xiaconfiguration/webservice/xiaconfiguration.asmx" $proxy = New-WebServiceProxy $uri -UseDefaultCredential  The following error is returned New-WebServiceProxy : The request failed with HTTP status 403: Forbidden. This limitation is confusing because the following command would help, however the cmdlet requires that a connection is immediately made, which is then too late to add the certificate $proxy . ClientCertificates . Add( $certificate ) This is somewhat annoying given that the Invoke-WebRequest cmdlet does have client cetific