Solved

c# vs2013 corrupt .dll

Posted on 2016-09-04
4
46 Views
Last Modified: 2016-09-06
I have created a library for use in some of my applications. It loads information into various classes in memory and keeps itself updated.

Recently I updated it due to a small issue. This went through developer and UAT testing without an issue.

There is an issue where it goes from working correctly to throwing an error that one of the fields on one of the classes does not exist. Needless to say this does exist and is initialized correctly.

Part of the investigation was to start an application that uses the .dll into Visual studio. I put a breakpoint at a point where a function is called that uses the field that I have the problems with but when the problem exists I cannot step into the function for some reason. If I check the object before the function is called I can also see the field that is supposedly missing.

This function is called often without an issue until this particular issue decides to show itself.

How could a compiled .dll seemingly change behaviour after it has been working correctly for hours and what would stop me stepping into the code that uses it (a few lines into the function)?
0
Comment
Question by:jetbet
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Stefan Hoffmann
ID: 41785065
I remember I had funny errors with libraries before, but that was a GAC issue. I had the same library (something.dll) in the same version (1.0.0.0) registered in the GAC and in the softwares directory. The version in the GAC is preferred, so when I changed the library and deployed the software I ran into problems because my changes did not apply. It took quite some time to find it.

Maybe it is something like that? Did you maybe register your library to the GAC?
0
 

Author Comment

by:jetbet
ID: 41785363
What would be the best way to release a new version of my .dll to my target machines? In this instance I copied the existing folder, renamed it, and dropped the new .dll into it.

So do I also need to rebuild the Application that uses it (it resides in the same directory as the executable) and how can I look on the target machine to see what version (or path to it) that it is using?
0
 
LVL 1

Accepted Solution

by:
Stefan Hoffmann earned 500 total points
ID: 41785565
Since I do not know about how you changed the code, I do not know if your application is compatible with your new dll or not. If the dll and the application depend on each other (share an interface) I'd include them into one solution in Visual Studio. Thus I never deploy a version of a dll without having built it with the application. I did not try this out yet. It should work if you do not change any parameters.

I have the following ideas that may help you:

How To find the version number:
You find the information about the version number in the file version information using explorer. Just go to the file, right click it, go to properties->details and take a look at the version number. Since you have the source of the dll file, you could change the version number there slightly so you can see the difference.

ildasm:
Another approach would be using ildasm to verify the contents of the dll and your application.
https://msdn.microsoft.com/de-de/library/f7dy01k1(v=vs.110).aspx
Here you can have a look at the compiled code directly, so you can see if the changes are in fact part of the content or if you have been tricked by some deployment issue.
There are .Net decompilers available that may be of even more help, since they can show you a c# source code derived from the compiled stuff.

Delete-It-Test:
To be certain that you do not by accident load a different version of the dll you could delete the dll from the directory and start the application. If it starts you know this may be not the version that is loaded after all. Then checking the GAC is highly recommended. Because it probably contains the version that is loaded then.

Different .Net Framework Versions of the library and the application?
You may run into weird issues if the library and the application are compiled for different .net versions.

Copy distribution works mostly fine with .Net Applications. I only once ran into a problem where the .Net Frameworks differed between development and production machine because one of the machines had all windows updates installed and the other one nearly none and somehow some method had been changed in the .Net Framework.

Let me know what you find.
0
 

Author Closing Comment

by:jetbet
ID: 41787153
Thanks for your help.

It looks as though I need to recompile the application if I want to change the .dll version
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DateTimepicker 4 33
Error on Add method 1 37
Vb. Net application freezes 9 28
Get Client IP on RDS - VB.NET 15 15
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now