Tuesday, November 22, 2016

Redis Cache and session start up.

I should have posted these a year earlier. Better late than never. As you might know setting up Redis is not easy task on your own in a windows machine for doing some development and testing. That itself will take a lot of time. But we are in luck. You can use Chocolatey package installer to setup the server and related configs easily. Install Chcolatey, use the PowerShell command its so cool, and click this link for redis command. Redis is done and the server will be available on default port (refer Redis site for details).

Now there are easy packages available through Nuget that will help you out with some samples based on MVC so start coding.

Will post some detailed links here later to help you out with some custom cache and session providers as i can't post mine due to some stupid rules.


C++ dll in C#

Yesterday i was passed on a task to Wrap up a c++ based dll to our c# based code base. And i had to confront lot issues for that, mainly Memory Access violations and Entry Point not found, pass by value and pass by reference issues. So i have made some small check list to help you out.

If you have the source to the c++ better, else lotto of debugging issues caused by your c++ dll will be hard to find,


1) Finding the correct entry point.
    a)If you have  the source use "extern c" in header files,
             This will help you out with the usage of function name and related problems,
    b) Else take the dump and check the function name and use it,

2) Parameter related issues
        Make sure the type are right are you passing by value or reference, some times as simple as StringBuilder can be of great use.

3) Does this dll have any read or write dependencies like logging.
       This did cause a lot of issues, as the dll some time uses file as parameters and at times also write some logs, beware if the logs are written inside the Bin folder, this might cause a rebuild of your app. Also setting up the correct folder paths might be also important with the proper read right access.


will add some examples in future.

Saturday, May 14, 2016

Session lost and reloading of binaries issue

Have you ever faced an issue where the session seems to be lost and in your visual studio there seems to be reloading the binaries while running your application, if yes then this might help.

check weather new files are being created in Bin folder or check if there is change in time after the previous build time for any dll or files. If so this will cause the reload of binaries and assemblies that you have used. Which will cause the restart of server(IIS or other ), resulting in lose of session.