2012-05-02 3 views
0

IsolatedFileStream에서 작동이 허용되지 않는 예외를 해결하려면 어떻게해야합니까?WP7 예외 오류 - IsolatedStorageFileStream에서 작동이 허용되지 않음

디버깅 후 특정 줄을 읽지 못하고 캐치 부분으로 건너 뛴 것을 깨달았습니다. 나는 skydrive에 업로드뿐만 아니라 Windows 전화 7 사진 샘플에서 이미지를 읽고 있습니다. 아무도이 문제를 최대한 빨리 해결하는 방법에 나를 안내 할 수 있습니까? 감사합니다. .

public BitmapImage fileName { get; set; } 

private void GetImages() 
{ 
    MediaLibrary mediaLibrary = new MediaLibrary(); 
    var pictures = mediaLibrary.Pictures; 

    foreach (var picture in pictures) 
    { 
     BitmapImage image = new BitmapImage(); 
     image.SetSource(picture.GetImage());    

     MediaImage mediaImage = new MediaImage(); 
     mediaImage.fileName = image; 
     UploadFile(mediaImage, picture.Name);     
    } 
} 

public void UploadFile(MediaImage image, string filepath) 
{ 
    if (skyDriveFolderID != string.Empty) 
    { 
    this.client.UploadCompleted += new EventHandler<LiveOperationCompletedEventArgs>(ISFile_UploadCompleted); 
    infoTextBlock.Text = "Uploading backup..."; 
    dateTextBlock.Text = ""; 

    try 
    { 
     using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) 
     { 
      // error occurs HERE 
      IsolatedStorageFileStream readStream = myIsolatedStorage.OpenFile(filepath, FileMode.Open, FileAccess.Read); 

      readStream.Close(); 
      this.client.UploadAsync(skyDriveFolderID, filepath, true, readStream, null) 
     } 
    }   
+1

예외 데이터를 게시 할 수 있습니까? 스택 추적 및 내부 예외 데이터가 유용합니다. –

답변

0

정말 오류가 발생합니까? 스트림을 읽으시기 전에 스트림을 닫고 있습니다. 그래서 당신이 오류의 잘못을 가지고있을 수 있습니다.

또한 정확한 이름을 가진 파일이 Isolated Storage에 있습니까?

+0

파일은 격리 된 저장소 안에 있지만 프로그램을 실행할 때마다 항상 readStream이 null로 읽습니다. 따라서 예외가 있습니다 - IsolatedFileStream에서 작동이 허용되지 않습니다. 어떻게 해결할 수 있을지 궁금 해서요? 감사. – tehyym16

관련 문제