Digital Tool Factory blog - Backend web development in Atlanta GA

The Digital Tool Factory Blog

How to fix the problem of undeletable characters in json strings in Visual Studio

So – you’re cruising around in web services, pulling data from various sources and your want to deserialize a string into an object, however, you can’t seem to remove extra quotations and escape characters. In fact everything you see looks like this

“{\”DataThingObject\”:{\”DataThingOneID\”:89,\”Status\”:\”Active\”,\”UserId\”:89,

and the \ and ” don’t go away, no matter how much text manipulation you do.

There actually isn’t a problem, you’re just looking at the string in the debugger, which adds the escape charachters for some reason – if you save it to a text or json file you will see that your json files are perfectly formatted.


06
Jul 18


Written By Steve French

 

How to fix the directory name is invalid IIS problem

Just restart the app pool and the problem goes away.


22
May 18


Written By Steve French

 

How to fix the problems with the package manager console in Visual Studio 2017

So – you’re getting the following problem

The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3763) : Error in type “System.Management.Automation.FormatViewDefinition”: Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.

For some reason this just started happening after the last Visual Studio 2017 update

Update – 5/29/2018 – make sure to leave VS Code open while you open Visual Studio 2017 – the problem does recur after every restart for some reason.

First – locate devenv.exe.config in the C:\Users\WarHorse\AppData\Local\Microsoft\VisualStudio\15.0_YOURIDENTIFIER directory

Open that file in VS Code

paste the following in with the other dependent assemblies

<dependentAssembly>
<assemblyIdentity name=”System.Management.Automation” publicKeyToken=”31bf3856ad364e35″ />
<publisherPolicy apply=”no” />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=”Microsoft.PowerShell.Commands.Utility” publicKeyToken=”31bf3856ad364e35″ />
<publisherPolicy apply=”no” />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=”Microsoft.PowerShell.ConsoleHost” publicKeyToken=”31bf3856ad364e35″ />
<publisherPolicy apply=”no” />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=”Microsoft.PowerShell.Commands.Management” publicKeyToken=”31bf3856ad364e35″ />
<publisherPolicy apply=”no” />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=”Microsoft.PowerShell.Security” publicKeyToken=”31bf3856ad364e35″ />
<publisherPolicy apply=”no” />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=”Microsoft.PowerShell.Commands.Diagnostics” publicKeyToken=”31bf3856ad364e35″ />
<publisherPolicy apply=”no” />
</dependentAssembly>


16
May 18


Written By Steve French

 

How to properly clone a project from Visual Studio.com

So – I recently had to clone a site off of Visual Studio.com lately – after some discovery, here are the proper steps

  1. Don’t try to do it from Visual Studio 2017 directly – instead just go to the project in VisualStudio.com, and click “Clone Is Visual Studio” – a dialogue window will pop up, and the combination f Visual Studio 2017 and Visual Studio.com will take care of everything for you
  2. Visual Studio will then be open to the FOLDER of the newly created project.  Note the folder location, then close Visual Studio, and open the solution (.sln) file in that folder (why Visual Studio doesn’t open it immediately I don’t know)
  3. From there, you have to copy over the nuget packages – in the nuget package manager, just enter “Update-Package -reinstall” and they will all be reinstalled or installed (that solution found here – the packages are not copied into source control)

and you’re done!


22
Jan 18


Written By Steve French

 

SideeX browser automation is awesome

The SideeX browser automation Chrome plugin is the single best tool I’ve come across this year.  It handles all the stuff that Selenium IDE would only do with great difficulty, and it did it on the first try.  Highly recommended.

 


29
Dec 17


Written By Steve French

 

How to fix irritating problems with TFS and Visual Studio 2017

Update – I did some more Googleing and found this page

Whereupon it says to

In your Team Explorer panel, click on Home > Projects > New Team Project…

Actually you have to click on Home to do it

but that gives you

Create from there

 

Due to a variety of circumstances I’m creating new projects with Visual Studio 2017, but using Team Foundation Server 2015 to house the source code – here is the proper sequence (for me) that gets the source code in place properly

  1.  Create Team Foundation Server Project using Visual Studio 2015 – note remote origin server
  2. Disconnect from VPN (and therefore TFS)
  3. Create Solution normally using Visual Studio 2017
  4. Do the normal “Add to Source Control” (from the File menu)  (if you do this while connected to the VPN/TFS it will try to force you to save it to TFS (where you can’t create a new project, or see the project you just created) – it will then do all the Git setup normally
  5. Reconnect to the VPN
  6. In the Team Explorer settings, add the remote origin server location to the “Remotes” section in the Repository settings – don’t forget to use the name “origin” as the name
  7. Commit and Push – everything should be working fine.

I’m sure there is a much better way to do this, but this is what works for me.


01
Dec 17


Written By Steve French

 

How to fix problems with Edit and Continue in Visual Studio 2017

For quite a while I’ve been trying to use the “Edit and Continue” feature of Visual Studio 2017, but kept on getting the warnings

  • attached to a process that does not support edit and continue
  • the code being debugged was optimized
  • intellitrace events and call information is enabled
  • the .net runtime this program is running on does not support edit and continue

So, on a whim, I uninstalled Stackify Prefix and voila!  Edit and Continue is now working just fine.


30
Nov 17


Written By Steve French

 

The peculiar problem when your entity framework query returns the same row for every record

This one had me confused for a long time, several hours in fact.  There were over 8,000 rows in the table, and the for some reason the query was returning the same row 8,000 times.  After much rending of garments and gnashing of teeth, I discovered that the table in question (in a sql server 2000 database (not created by me)) had no primary key defined.

So – I copy the data into a new table, create a key with the commands

alter table TableInQuestion
add NewIDColumn int identity(1,1)

Delete the empty key field (that was what threw me, there was a column named “Id”, which was not actually and ID column.) rename “NewIDColumn” to “Id”, then point EF to the new table with the data attribute (on the object)

[Table(“TableInQuestion”)]

and everything works like a charm

 


22
Sep 17


Written By Steve French

 

Connecting Entity Framework to Sql Server 2000

A lesson learned – when trying to map Entity Framework to Sql Server 2000  (if you must) – make sure that there are no nullable dates – if so, work around them.  I just spent hours looking into that.


25
Jul 17


Written By Steve French

 

Something to watch for on WordPress shortcodes

The first inclination is to create a shortcode that will look like [MyShortCode]My Only Parameter[/MyShortCode], which would look like this

function MyShortCode_func($content = null){
//————-stuff happens
return $processedContent;
}

However, if you want to have parameters = you must have the $atts parameter in the function, even if it is not used.  The proper function would be

function MyShortCode_func($atts, $content = null){
//————-stuff happens
return $processedContent;
}


12
Jun 17


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.