Click here to Skip to main content
14,265,813 members
   

C#

 
AnswerRe: Very simple Async Client/Server Pin
Mycroft Holmes20-Jun-19 14:37
memberMycroft Holmes20-Jun-19 14:37 
AnswerRe: Very simple Async Client/Server Pin
jschell23-Jun-19 6:08
memberjschell23-Jun-19 6:08 
Questionhow to create a chat application that a private chat user with a c # mvc Pin
xuannam12039220-Jun-19 0:59
memberxuannam12039220-Jun-19 0:59 
AnswerRe: how to create a chat application that a private chat user with a c # mvc Pin
OriginalGriff20-Jun-19 1:03
protectorOriginalGriff20-Jun-19 1:03 
AnswerRe: how to create a chat application that a private chat user with a c # mvc Pin
#realJSOP20-Jun-19 1:23
mve#realJSOP20-Jun-19 1:23 
Questionretrieval of XML information & Copy to excel Files Pin
Member 1450608919-Jun-19 13:18
memberMember 1450608919-Jun-19 13:18 
AnswerRe: retrieval of XML information & Copy to excel Files Pin
OriginalGriff19-Jun-19 19:59
protectorOriginalGriff19-Jun-19 19:59 
Questionsome bugs don't retire II: DataContract.ReadObject (includes solution by Richard Deeming) Pin
BillWoodruff18-Jun-19 17:43
mveBillWoodruff18-Jun-19 17:43 
This has been around like forever: the only solution I know is to explicitly delete the file before each write.

Even though you try and make sure the 'stream is closed using something like:
// not complete code, excerpt from working code: instantiation of variables not shown
// 'TheData1 is an instance of a Class with one public string property
try
{
    using (Stream stream1 = new FileStream(path1, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
    {
        dcs1.WriteObject(stream1, this.TheData1);
        stream1.Position = 0L; // as if this would help
        stream1.Close(); // throwing salt over shoulder
    }
}
catch (Exception ex)
{
    MessageBox.Show($"{path1} in use");
    return;
}
That can lead to the dread message: "The data at the root level is invalid. Line 1, position 1." after multiple writes: even though careful scrutiny of the XML content of multiple writes shows no special characters inserted, no structural differences, in the files written.

Of course, I would be chuffed to know there is another way !
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot


modified 19-Jun-19 18:07pm.

AnswerRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard MacCutchan18-Jun-19 20:46
protectorRichard MacCutchan18-Jun-19 20:46 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff18-Jun-19 21:03
mveBillWoodruff18-Jun-19 21:03 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard MacCutchan18-Jun-19 21:18
protectorRichard MacCutchan18-Jun-19 21:18 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff18-Jun-19 21:54
mveBillWoodruff18-Jun-19 21:54 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard MacCutchan18-Jun-19 21:58
protectorRichard MacCutchan18-Jun-19 21:58 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff18-Jun-19 22:04
mveBillWoodruff18-Jun-19 22:04 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard MacCutchan18-Jun-19 22:39
protectorRichard MacCutchan18-Jun-19 22:39 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard Deeming19-Jun-19 0:57
mveRichard Deeming19-Jun-19 0:57 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff19-Jun-19 4:24
mveBillWoodruff19-Jun-19 4:24 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard Deeming19-Jun-19 5:04
mveRichard Deeming19-Jun-19 5:04 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff19-Jun-19 12:05
mveBillWoodruff19-Jun-19 12:05 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard MacCutchan21-Jun-19 22:01
protectorRichard MacCutchan21-Jun-19 22:01 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff21-Jun-19 22:09
mveBillWoodruff21-Jun-19 22:09 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Richard MacCutchan21-Jun-19 22:34
protectorRichard MacCutchan21-Jun-19 22:34 
AnswerRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
F-ES Sitecore18-Jun-19 23:51
mveF-ES Sitecore18-Jun-19 23:51 
GeneralRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
BillWoodruff19-Jun-19 0:54
mveBillWoodruff19-Jun-19 0:54 
AnswerRe: some bugs don't retire II: DataContract.ReadObject fails after multiple writes to the same file Pin
Gerry Schmitz19-Jun-19 5:16
mveGerry Schmitz19-Jun-19 5:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.