Cool feature in Visual Studio – Generate Class from JSON or XML

Hi Everyone,

Today I was asked a question by one of my friends on if I know any easy way which can generate C# Class if we give JSON as an input. And I don’t know anyway but certainly there should be an easy way to do the same.

To my surprise, it turned to be a very easy one. Visual Studio has cool feature, copy JSON or XML to the clipboard –> Open any class file –> Edit –> Paste Special.

Hope this helps.

Happy Coding

Logging in Azure Web APP


Today I was developing an Web APP and it was giving an error after I host it on Azure. To understand the error I have log the traces. Here is the way that explains that how we can do that.

We can directly use Trace class (System.Diagnostics.Trace) for write the logs. I have written the below piece of the code as a first line in the method.

System.Diagnostics.Trace.WriteLine(“I am getting called…”);

Now navigate to your Azure Account –> The app service where you have deployed the Web APP –> Diagnostics Logs.

You have something called “Application Logging (Filesystem)” and you can switch it on. There are four options available there.

Error – Error, Critical
Warning – Warning, Error, Critical
Information – Info, Warning, Error, Critical
Verbose – Trace, Debug, Info, Warning, Error, Critical (all categories)

I normally prefer Verbose as it gives everything.

Now, browse the URL for hitting the action where you have written the tracing.

Navigate to Advance Tools under you AppService and Click on Go

It opens a new tab as below – Click on Debug console and then CMD.

You will see the below screen, click on LogFiles –> Application, you will see the .txt file. Click on Edit icon to see the logs.

Note : For Application logging, you can turn on the file system option temporarily for debugging purposes. This option turns off automatically in 12 hours

Happy Coding