Social Icons

Sunday, 12 November 2017

Sql Server - Fix Error - Can not use the backup file because it was originally formatted with 512 and is now on a device with sector size 4096

Recently i encountered Sql Server Error when i try to take backup of database from SSMS (Sql Server Management Studio) i.e

System.Data.SqlClient.SqlError : can not use the backup file "path" because it was originally formatted with sector size 512 and is now on a device with sector size 4096


 Problem is , backup file which was created with different sector size , so it is not possible now to use it. So solution is remove that backup file 

Now add the new file for taking backup and ok

That's it simple. Just remove the old backup file with different sector size.

Friday, 27 October 2017

[Solved] C# - OriginalValues cannot be used for entities in the Added state Visual Studio Error

Hi, recently i encountered runtime error when i try to insert values using Entity Framework

"OriginalValues cannot be used for entities in the Added state"

This could arise because missing column or inserting null value or column width exceeding in insert statement.

You can find the error message in Exception object 


Based on your Error Message you can take corrective action to rectify this.


Friday, 29 September 2017

[SOLVED] access denied can not execute the program csc.exe after publishing .net application web deploy mvc app

Hi, Recently i encountered this error after publishing an application to winhost server.

Error stacktrace is
[Win32Exception (0x80004005): Access is denied]

[ExternalException (0x80004005): Cannot execute a program. The command being 
executed was "E:\web\nrgwareh\bin\roslyn\csc.exe"

It is an mvc application using visual studio 2017 , targeted framework is 4.6.2.

I just published using webdeploy method. it is successfully deployed but when i try to run i encountered this one like

when i run locally its working fine. But here problem is winhost doesn't allow csc.exe to run which is roslyn compilation.

When we create a web application either webforms or mvc using .net framework 4.5 > then project is pre installed with roslyn csc.exe compilation. although it was successfully published to hosting environment, but some servers doesn't allow to run that roslyn compiler.

Solution 1:

Here solution is just compile and deploy project without any roslyn or any csc.exe files.

just go to Nuget manager, find  the package Microsoft.CodeDom.Provider.DotnetCompilerPlatform , uninstall it.

Now rebuild and re publish, then this problem gone away.

Solution 2:

In some hosting environments we have option to allow or run csc.exe files, just change that setting or allow read/write to exe files, it get's fixed.

Hope it can be useful to some folks.

Tuesday, 5 September 2017

[Solved] Extender Provider failed to return an Extender for this project - Visual Studio Community 2015

Hi.., Recently i encountered visual studio designer exception when i try to open EDM file in visual studio " Extender Provider failed to return an Extender for this project " like this below

Problem is i have been running the application 5 hours plus time, without stopping in local.

Then when i try to view edmx file, encounter this exception.

To stop this exception just reload the project so that all objects gets created again and available to view.

When an application is running idle for hours, it is better to reload that project.

You don't have to delete obj and bin folders. But for different situations it may work. Possibly when this exception encountered while in working in designer mode by simply reloading project, you can remove that exception.

Saturday, 18 February 2017

[Solved] : failed to create component 'Report Viewer' System.runtime.interopservices.COMException(0x8004D745)

Hi there. Recently i encountered this error when i migrated visual studio 2008 windows application to vs 2012 . Here i am dragging  report viewer to control on windows form, then i encountered a long list of error message

Problem is project reference is enabled for version 10.0.0 for report viewer but toolbox is adding version.

Solution: just add the System.ReportViewer.Winforms version remove version.

You will get these kind of designer errors when you migrate to higher version. Just check the references added to project properly.

Hope it helps you.