Reputation: 13
We have an application that reads a xml file from local files(i.e. c:\Temp\Imports
When we are running the application inside visual studio, on debug mode, the files is read normaly, but when we deploy and install the application, it does not read, and gives no error, no exception.
All this happens under windows 8.1
Anyone has ever found this kind of situation.
xmlSerializer = new XmlSerializer(typeof(List<Common.CCeEntityClientLibrary.Entities.Produto>),
new XmlRootAttribute("Produtos"));
List<Common.CCeEntityClientLibrary.Entities.Produto> lstProducts;
using (var fileStream = new FileStream(fullFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
lstProducts =
(List<Common.CCeEntityClientLibrary.Entities.Produto>)
xmlSerializer.Deserialize(fileStream);
}
Update:
catch (Exception ex)
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine("Não foi possível realizar a importação do o arquivo '{0}' através do método '{1}'");
stringBuilder.AppendLine("Descrição: {2}");
Common.CCeCommonLibrary.Errors.EventLogManager.WriteEventLog(
string.Format(stringBuilder.ToString(), fileName,
System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message));
}
This part is where the error is logged which does not happens
Upvotes: 0
Views: 69
Reputation: 3752
If it's not throwing an exception, that means it found the file and opened it. XmlSerializer likely is encountering different XML than what it's expecting. Check the file that it's looking at to make sure that the XML is correct.
Another option is that the EventLogManager isn't working in that environment, and there IS an error. You could remove the exception handling temporarily and see if it blows up.
Upvotes: 1