This project has moved. For the latest updates, please go here.

PDB's not available for 3.5 SP1

Aug 23, 2008 at 3:43 PM
Hello
I've tried to download source code and pdb files but response for all assemblies was "Not available"
Can you explain, what is the reason?

command line: netmassdownloader -d "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5" -d "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0" -d c:\Windows\microsoft.net\framework\v2.0.50727 -o "D:\Work\dotnet3.5"

SP1 for .net framework and VS is installed
Coordinator
Aug 25, 2008 at 9:37 AM
Hi Desco,

Ask Microsoft i will comment :) Just joking they didn't made the pdb's and source code for SP1 available yet.

You can mail Shawn Burke for this issue or post to the shared source forum about the issue.

Also check this link , same problem in the retail version also:

http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3740215&SiteID=1

Best Regards
Kerem Kusmezer
Aug 26, 2008 at 4:09 PM
Hello,
the PDB's are available now, but this tool still doesn't work with SP1.
It seems that microsoft has changed the User-Agent parameter:

GET /symbols/System.Windows.Forms.pdb/14AC72FC188044CAA07EA5A40BDDEA201/System.Windows.Forms.pdb HTTP/1.1
Accept-Encoding: gzip
User-Agent: Microsoft-Symbol-Server/6.9.0003.113
Host: referencesource.microsoft.com
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: RSCCAuth=%2bRufRQLrjnZPcohBIHXCWw%3d%3d; MC1=GUID=dd4202d554c4ca4f9d646561f613aed3&HASH=d502&LV=20087&V=3; A=I&I=AxUFAAAAAADbCAAAqCf2fnpJoMI7aOydAAsxZA!!&M=1&CS=112iee002gN9116002H910802jW590S01g15@0001p15900; MUID=C02A11A16B4B493AB138F600D4709990; WT_NVR_RU=0=msdn|technet:1=:2=; ANON=A=0B378B7E8A6F90CD6C8062CCFFFFFFFF&E=74b&W=1; NAP=V=1.6&E=6f1&C=u_gPNARbEdeQPosJaP3exOS1rr3t_zMywjomoBuIi9kB3dbahtbHrA&W=1; WT_FPC=id=80.152.131.231-813866512.29945228:lv=1219754957095:ss=1219754957095

 Regards
Anateus

Coordinator
Aug 26, 2008 at 10:43 PM
Hi Anateus,

It seems they switched from compressed pdb files to just raw gzip compression.
I will adjust the .Net Massdownloader to work with this.

Thx for the reply.
Coordinator
Aug 27, 2008 at 12:53 AM

Hi Anateus,

I made the change on the code base, now it uses the old and new download procedures and automatically detects the service pack levels for the installed frameworks.

It seems that the old pdb's where compressed with compress util like cab files and to request them we had to use the .pd_ extension instead of .pdb, i changed the download routine to

.pdb fro .pd_ now it is just working fine, but the sourcecode are not made public yet.

Best Regards

Kerem Kusmezer

 

Coordinator
Aug 27, 2008 at 1:00 AM
You can apply the test changes if you want to the project using the following steps:

1)Add a new file called FrameworkVersionDetector.cs under Project DownloadLibrary to the folder Classes.

2) Add the following code inside:

using

 

System;

 

 

using

 

System.Collections.Generic;

 

 

using

 

System.Text;

 

 

using

 

Microsoft.Win32;

 

 

namespace

 

DownloadLibrary.Classes

 

{

 

 

public abstract class FrameworkVersionData

 

 

{

 

public abstract string GetUserAgentVersion();

 

 

 

public string VersionNumber

 

{

 

 

get;

 

 

 

protected set;

 

}

 

 

public int SPLevel

 

{

 

 

get;

 

 

 

protected set;

 

}

 

 

public int InstallLevel

 

{

 

 

get;

 

 

 

protected set;

 

}

 

 

public string InstallPath

 

{

 

 

get;

 

 

 

protected set;

 

}

 

 

public string CBSLevel

 

{

 

 

get;

 

 

 

protected set;

 

}

 

 

public string OCMLevel

 

{

 

 

get;

 

 

 

protected set;

 

}

 

 

protected FrameworkVersionData(RegistryKey rootKey){

 

 

 

this.SPLevel = Convert.ToInt32(rootKey.GetValue("SP"));

 

 

 

this.InstallLevel = Convert.ToInt32(rootKey.GetValue("Install").ToString());

 

 

 

this.VersionNumber = rootKey.GetValue("Version").ToString();

 

}

 

 

static FrameworkVersionData()

 

{

m_relevantVersionData =

 

new Framework35VersionData(FrameworkVersionDetector.V35DirectKey);

 

}

 

 

 

private static FrameworkVersionData m_relevantVersionData;

 

 

 

public static FrameworkVersionData RelevantVersionData

 

{

 

 

get

 

 

{

 

//To Do Extended Here Later

 

 

 

//return new Framework35VersionData(FrameworkVersionDetector.V35DirectKey);

 

 

 

return m_relevantVersionData;

 

}

}

}

 

 

internal class Framework35VersionData : FrameworkVersionData

 

 

{

 

public Framework35VersionData(RegistryKey rootKey):base(rootKey){

 

}

 

 

public override string GetUserAgentVersion()

 

{

 

 

if (this.SPLevel > 0){

 

 

 

return "Microsoft-Symbol-Server/6.9.0003.113";

 

}

 

 

else{

 

 

 

return "Microsoft-Symbol-Server/6.8.0004.0";

 

}

}

}

 

 

public static class FrameworkVersionDetector

 

 

{

 

internal const string FrameworkSetupBaseRegistryPath =

 

 

 

@"SOFTWARE\Microsoft\Net Framework Setup\NDP\";

 

 

 

internal const string Frameworkv20RegistryPathExtension =

 

 

 

@"v2.0.50727";

 

 

 

internal const string Frameworkv30RegistryPathExtension =

 

 

 

@"v3.0";

 

 

 

internal const string FrameworkV35RegistryPathExtension =

 

 

 

@"v3.5";

 

 

 

public static Microsoft.Win32.RegistryKey V20DirectKey

 

{

 

 

get

 

 

{

 

return

 

 

 

Registry.LocalMachine.OpenSubKey(FrameworkSetupBaseRegistryPath + Frameworkv20RegistryPathExtension);

 

}

}

 

 

public static Microsoft.Win32.RegistryKey V30DirectKey

 

{

 

 

get

 

 

{

 

return

 

 

 

Registry.LocalMachine.OpenSubKey(FrameworkSetupBaseRegistryPath + Frameworkv30RegistryPathExtension);

 

}

}

 

 

public static Microsoft.Win32.RegistryKey V35DirectKey

 

{

 

 

get

 

 

{

 

return

 

 

 

Registry.LocalMachine.OpenSubKey(FrameworkSetupBaseRegistryPath + FrameworkV35RegistryPathExtension);

 

}

}

}

}

 


3) Change the following classes in DownloadLibrary :
DownloadLibrary\Classes\Eula\PDBWebClient.cs - (107, 89) : this.Headers.Add("User-Agent", FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());
DownloadLibrary\Classes\Eula\PDBWebClient.cs - (117, 89) : this.Headers.Add("User-Agent", FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());
DownloadLibrary\Classes\Eula\PDBWebClient.cs - (126, 89) : this.Headers.Add("User-Agent", FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());
DownloadLibrary\Classes\Utility.cs - (294, 87) : wc.Headers.Add("User-Agent", FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());

4) Change the following method in DownloadLibrary.PEParsing.PEFile.DownloadPDBFromServer from the current to this:

 

public bool DownloadPDBFromServer(string targetPath)

 

{

 

bool allOk = false;

 

 

try

 

{

targetPath =

Utility.CleanupPath(targetPath);

 

 

if (!System.IO.Directory.Exists(targetPath))

 

{

System.IO.

Directory.CreateDirectory(targetPath);

 

}

 

PDBWebClient pdbDownloader = GetWebClientWithCookie();

 

 

string targetFile = this.PdbFileName;

 

 

if (FrameworkVersionData.RelevantVersionData.SPLevel == 0)

 

{

targetFile =

String.Format("{0}{1}/{2}/{3}",

 

 

this.SymbolServerUrl, targetFile, this.PdbVersion, targetFile.Replace(".pdb", ".pd_"));

 

 

string compressedFileName =

 

targetPath +

this.PdbFileName.Replace(".pdb", ".pd_");

 

System.Diagnostics.

Debug.WriteLine("Pdb Location For Retrieval:" + targetFile);

 

 

if (pdbDownloader.DownloadFileWithProgress(targetFile, compressedFileName))

 

{

 

if (Decompressor.ExpandSourceFileToTarget(compressedFileName, targetPath, this.PdbFileName))

 

{

allOk =

true;

 

}

}

 

if (this.CleanupTempCompressedSymbols)

 

{

 

if (File.Exists(compressedFileName))

 

{

 

File.Delete(compressedFileName);

 

}

}

}

 

else

 

{

targetFile =

String.Format("{0}{1}/{2}/{3}",

 

 

this.SymbolServerUrl, targetFile, this.PdbVersion, targetFile);

 

 

string compressedFileName =

 

targetPath +

this.PdbFileName;

 

 

if (pdbDownloader.DownloadFileWithProgress(targetFile, compressedFileName))

 

{

allOk =

true;

 

}

}

}

 

catch (Exception ex)

 

{

System.Diagnostics.

Debug.Write(ex.Message + "targetPath download failed");

 

 

throw;

 

}

 

return allOk;

 

}


After this changes you will be able to download the pdb's for the framework version 3.5 SP1. It seems that the sourcecodes are not made public yet, only the pdb's.
Coordinator
Aug 29, 2008 at 3:18 PM

Hi,

 

I have updated netmassdownloader for VS2008 SP1 source code download.

You can download the latest copy from:

 

http://www.codeplex.com/NetMassDownloader/Release/ProjectReleases.aspx?ReleaseId=16783

 

And download whole the source code for SP1 at once.

 

Best Regards

Kerem Kusmezer

Sep 1, 2008 at 7:23 AM
Thanks a lot!
Is the Framework source available now? I'm still getting the not available error.
Regards
Anateus
Coordinator
Sep 1, 2008 at 8:04 AM
Hi Anateus,

I downloaded it already yesterday, not everything is available but things like System.dll , mscorlib.dll are available.
Sep 1, 2008 at 11:47 AM
Edited Sep 1, 2008 at 12:05 PM
Hi keremkusmezer,
I have just added the ability to use the gzip encoding of source server. Feel free to implent it.
PDBWebClient.cs (Edited Aug 29 at 1:00 PM):



#region Licence Information
/*      
 * http://www.codeplex.com/NetMassDownloader To Get The Latest Version
 *    
 * Copyright 2008 Kerem Kusmezer(keremskusmezer@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 *
*/
#endregion

#region Imported Libraries
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.IO.Compression;
#endregion

namespace DownloadLibrary.Classes.Eula
{
    //[CLSCompliant(true)]
    public class PDBWebClient : System.Net.WebClient
    {
        string m_contentEncoding = null;

        private bool m_is210Requested;

        public bool IsEulaResponse
        {
            get {
                return m_is210Requested;
            }
            set {
                m_is210Requested = value;
            }
        }

        private string m_eulaBody;

        /// <summary>
        /// Returns The Eula Body Returned By The MS Reference Server
        /// </summary>
        public string EulaBody
        {
            get { return m_eulaBody; }
            private set { m_eulaBody = value; }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="proxyUri"></param>
        /// <param name="proxyCredential"></param>       
        public PDBWebClient(System.Uri proxyUri, System.Net.NetworkCredential proxyCredential):base()
        {
            //BugFix 1113 Kerem Kusmezer 12.02.2008
            base.Proxy = new System.Net.WebProxy(proxyUri);
            base.Proxy.Credentials = proxyCredential;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="proxyUrl"></param>
        /// <param name="proxyUsername"></param>
        /// <param name="proxyPassword"></param>
        /// <param name="proxyDomain"></param>
        public PDBWebClient(string proxyUrl,string proxyUsername,string proxyPassword,string proxyDomain):base()
        {
            //BugFix 1113 Kerem Kusmezer 12.02.2008
            base.Proxy = new System.Net.WebProxy(new System.Uri(proxyUrl));
            System.Net.NetworkCredential tempCredential = null;
            if (String.IsNullOrEmpty(proxyDomain))
            {
                tempCredential =
                    new System.Net.NetworkCredential(proxyUsername, proxyPassword);
            }
            else
            {
                tempCredential =
                    new System.Net.NetworkCredential(proxyUsername,proxyPassword,proxyDomain);
            }
            base.Proxy.Credentials = tempCredential;
        }
        /// <summary>
        ///
        /// </summary>
        public PDBWebClient():base()
        {
        }

        public new void DownloadFile(Uri address, string fileName)
        {
            if (this.Headers[HttpRequestHeader.UserAgent] == null)
            {
                this.Headers.Add(HttpRequestHeader.UserAgent, FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());
            }
            base.DownloadFile(address, fileName);
            if (!string.IsNullOrEmpty(m_contentEncoding))
            {
                using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite))
                {
                    byte[] buffer = null;
                    if (m_contentEncoding.Contains("gzip"))
                    {
                        buffer = DecompressStreamWithGzip(stream);
                    }
                    else if (m_contentEncoding.Contains("deflate"))
                    {
                        buffer = DecompressStreamWithDeflate(stream);
                    }
                    if (buffer != null)
                    {
                        stream.Seek(0, SeekOrigin.Begin);
                        stream.Write(buffer, 0, buffer.Length);
                    }
                }
            }
        }

        public new void DownloadFile(string address, string fileName)
        {
            if (this.Headers[HttpRequestHeader.UserAgent] == null)
            {
                this.Headers.Add(HttpRequestHeader.UserAgent, FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());
            }
            base.DownloadFile(address, fileName);
        }
        public new byte[] DownloadData(string url)
        {
            if (this.Headers[HttpRequestHeader.UserAgent] == null)
            {
                this.Headers.Add(HttpRequestHeader.UserAgent, FrameworkVersionData.RelevantVersionData.GetUserAgentVersion());
            }
            byte[] resultBytes = base.DownloadData(url);
            if (!string.IsNullOrEmpty(m_contentEncoding))
            {
                using (MemoryStream stream = new MemoryStream(resultBytes))
                {
                    if (m_contentEncoding.Contains("gzip"))
                    {
                        resultBytes = DecompressStreamWithGzip(stream);
                    }
                    else if (m_contentEncoding.Contains("deflate"))
                    {
                        resultBytes = DecompressStreamWithDeflate(stream);
                    }
                }
            }
            if (m_is210Requested)
            {
                m_eulaBody = System.Text.Encoding.Unicode.GetString(resultBytes);
            }
            return resultBytes;
        }
        protected override System.Net.WebRequest GetWebRequest(Uri address)
        {
            System.Net.WebRequest tempRequest =
                base.GetWebRequest(address);
            return tempRequest;
        }
        protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest request)
        {           
            System.Net.WebResponse requestResponse =
            base.GetWebResponse(request);
           
            this.CheckResponse( requestResponse );
            return requestResponse;
        }

 

        #region [HDN] Additional Code
        #region Instance Properties
        private readonly object m_syncRoot = new object();
        protected object SyncRoot {
            get {
                return m_syncRoot;
            }
        }

        private DateTime m_lastFileWriteTimeOnServer;
        public DateTime LastFileWriteTimeOnServer {
            get { return m_lastFileWriteTimeOnServer; }
        }

        private bool m_hasLastFileWriteTimeOnServer = false;
        public bool HasLastFileWriteTimeOnServer {
            get { return m_hasLastFileWriteTimeOnServer; }
        }
        #endregion Instance Properties

        #region Instance Methods
        #region Public
        public bool DownloadDataWithProgress( string url, out byte[] downloadData ) {
            downloadData = new byte[] {};

            Utility.AddUserAgentHeaderIfNecessary( this );

            DownloadInfo di = new DownloadInfo();
            base.DownloadDataAsync( new Uri(url), di );

            WaitUntilDownloadCompleted( di );
            bool ok = di.Successful;

            if (ok) {
                downloadData = (byte[]) di.Result;
                if (!string.IsNullOrEmpty(m_contentEncoding))
                {
                    using (MemoryStream stream = new MemoryStream(downloadData))
                    {
                        if (m_contentEncoding.Contains("gzip"))
                        {
                            downloadData = DecompressStreamWithGzip(stream);
                        }
                        else if (m_contentEncoding.Contains("deflate"))
                        {
                            downloadData = DecompressStreamWithDeflate(stream);
                        }
                    }
                }
                if (m_is210Requested) {
                    m_eulaBody = System.Text.Encoding.Unicode.GetString(downloadData);
                }
            }
            return ok;
        }

        public bool DownloadFileWithProgress(string address, string fileName) {
            Utility.AddUserAgentHeaderIfNecessary( this );

            DownloadInfo di = new DownloadInfo();
            base.DownloadFileAsync(new Uri(address), fileName, di);

            WaitUntilDownloadCompleted( di );

            if (di.Successful)
            {
                if (!string.IsNullOrEmpty(m_contentEncoding))
                {
                    using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite))
                    {
                        byte[] buffer = null;
                        if (m_contentEncoding.Contains("gzip"))
                        {
                            buffer = DecompressStreamWithGzip(stream);
                        }
                        else if (m_contentEncoding.Contains("deflate"))
                        {
                            buffer = DecompressStreamWithDeflate(stream);
                        }
                        if (buffer != null)
                        {
                            stream.Seek(0, SeekOrigin.Begin);
                            stream.Write(buffer, 0, buffer.Length);
                        }
                    }
                }
                if (m_hasLastFileWriteTimeOnServer)
                {
                    File.SetLastAccessTimeUtc(fileName, m_lastFileWriteTimeOnServer);
                }
            }
            else
            {

                // The WebClient base class can create a zero byte file so
                // make sure to delete the file and directory so there's not
                // bad PDB files left around.  I would rather not do this here
                // but the problem is in WebClient, not this application.
                // BugFix 2623 it doesn't work with -o switch instead deleting the above folder , it deletes the entire folder.
                if (true == File.Exists(fileName) && new FileInfo(fileName).Length == 0)
                {
                    File.Delete(fileName);
                    String file = Path.GetFileName(fileName);
                    String path = Path.GetDirectoryName(fileName);
                    // If the filename is in the path, this file was
                    // going into the symbol server.
                    int i = path.IndexOf(file);
                    if (-1 != i)
                    {
                        path = path.Substring(0, i + file.Length);
                        //Bugfix 2623 So Moving The Folder Delete Here Solves The Bug
                        Directory.Delete(path, true);
                    }
                }
            }

            return di.Successful;
        }
        #endregion Public

        #region Overrides
        protected override WebResponse GetWebResponse( WebRequest request, IAsyncResult result ) {
            WebResponse response = base.GetWebResponse( request, result );
            this.CheckResponse( response );
            return response;
        }
        #endregion Overrides

        #region Helpers
        private void WaitUntilDownloadCompleted( DownloadInfo di ) {
            while (true) {
                object result = null;
                lock( m_syncRoot ) {
                    result = di.Result;
                }

                if (result != null) {
                    break;
                }

                Thread.Sleep( 500 );
            } // while
        }

        private void CheckResponse( WebResponse requestResponse ) {
            m_hasLastFileWriteTimeOnServer = false;

            string str = requestResponse.Headers[HttpResponseHeader.LastModified];
            if (!string.IsNullOrEmpty( str )) {
                m_lastFileWriteTimeOnServer = DateTime.Parse( str );
                m_hasLastFileWriteTimeOnServer = true;
            }

            m_contentEncoding = requestResponse.Headers[HttpResponseHeader.ContentEncoding];
            if (m_contentEncoding != null) m_contentEncoding = m_contentEncoding.ToLower();

            if (requestResponse is HttpWebResponse)
            {
                HttpWebResponse httpResponse = (HttpWebResponse)requestResponse;
               
                if (m_is210Requested && (httpResponse.StatusCode == HttpStatusCode.OK)) {
                    Eula.EulaContents.SaveEulaCookie(httpResponse);
                }
               
                //BUGFIX 1128 08.02.2008 Kerem Kusmezer It seems the Status Description
                //Has Been Stripped Or Replaced With Unknown In Some Proxy Servers
                //Thanks Florin
                //(()
                //&& (httpResponse.StatusDescription == "End User License Agreement");
                m_is210Requested = ((int)httpResponse.StatusCode == 210);
                   
               
                httpResponse = null;

            }
        }

        const int buffersize = 4096;

        private byte[] DecompressStreamWithGzip(Stream readStream)
        {
            using (MemoryStream bufferstream = new MemoryStream())
            {
                using (GZipStream decoder = new GZipStream(readStream, CompressionMode.Decompress))
                {
                    byte[] buffer = new byte[buffersize];
                    int numbytes = decoder.Read(buffer, 0, buffersize);
                    do
                    {
                        bufferstream.Write(buffer, 0, numbytes);
                        numbytes = decoder.Read(buffer, 0, buffersize);
                    } while (numbytes != 0);
                }
                return bufferstream.ToArray();
            }
        }

        private byte[] DecompressStreamWithDeflate(Stream readStream)
        {
            using (MemoryStream bufferstream = new MemoryStream())
            {
                using (DeflateStream decoder = new DeflateStream(readStream, CompressionMode.Decompress))
                {
                    byte[] buffer = new byte[buffersize];
                    int numbytes = decoder.Read(buffer, 0, buffersize);
                    do
                    {
                        bufferstream.Write(buffer, 0, numbytes);
                        numbytes = decoder.Read(buffer, 0, buffersize);
                    } while (numbytes != 0);
                }
                return bufferstream.ToArray();
            }
        }

        #endregion
        #endregion Instance Methods
        #endregion [HDN] Additional Code

    }

    #region Class: DownloadInfo
    public class DownloadInfo {
        private object _result = null;
        private bool _firstTime = true;
        private bool _printedTotal = false;
        private string _lastToken = null;

        private bool _hasProgress = false;
        private bool _progressDone = false;

        public object Result {
            get { return _result; }
            set { _result = value; }
        }
        public bool Successful {
            get { return (!(_result is Exception)); }
        }

        public bool FirstTime {
            get { return _firstTime; }
            set { _firstTime = value; }
        }

        public bool PrintedTotal {
            get { return _printedTotal; }
            set { _printedTotal = value; }
        }

        public string LastToken {
            get { return _lastToken; }
            set { _lastToken = value; }
        }

        public bool HasProgress {
            get { return _hasProgress; }
            set { _hasProgress = value; }
        }
        public bool ProgressDone {
            get { return _progressDone; }
            set { _progressDone = value; }
        }
    }
    #endregion Class : DownloadInfo
}

Coordinator
Sep 1, 2008 at 12:17 PM

Hi Anateus,

I have 2 test computers ,

one with Windows XP With SP2 and .Net Framework 3.5 SP1 With VS2008 and VS2005 installed.

the other one is with Windows Vista Ultimate Home Edition With SP1 and .Net Framework 3.5 SP1 With VS2008 and VS2005 installed.

In both of the machines the gzipped content seems to be automatically decoded, but i will add the support to the code , if it is not working in your computer.

Can you give me please your configuration? I will debug the section with the MS Source Code for WebClient.

Best Regards

Kerem Kusmezer

 

Sep 1, 2008 at 12:30 PM
Hi keremkusmezer,
I'm working on Windows XP with SP3, .Net Framework 3.5 SP1 and VS2008 with SP1.
To the second thing, you don't need to debug this, because you can't get gzipped content with your release, because the Accept-Encoding header is not sent to the server. I forgot to show you the other changes.
In Utility.cs:

 

public static void AddHeadersIfNecessary( WebClient wc ) {
...

 

  AddAcceptEncodingHeaderIfNecessary( wc );
}

 

 

public static void AddAcceptEncodingHeaderIfNecessary( WebClient wc )

 

{

 

if (wc.Headers[HttpRequestHeader.AcceptEncoding] == null)

 

{

wc.Headers.Add(

HttpRequestHeader.AcceptEncoding, "gzip");

 

}

}
greets
Anateus

Sep 1, 2008 at 2:24 PM
Edited Sep 1, 2008 at 2:29 PM

Hi,
now I see, there is a possibility to activate automatic decompression, but you need to explicitly activate it.
PDBWebClient.cs:

          protected override System.Net.WebRequest GetWebRequest(Uri address)
        {
            System.Net.WebRequest tempRequest =
                base.GetWebRequest(address);
            if (tempRequest is HttpWebRequest)
                ((HttpWebRequest)tempRequest).AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
            return tempRequest;
        }

But this doesn't work correctly, because the last gzipped block isn't decompressed. So if it's only one block the file is empty.

 

 

Sep 2, 2008 at 2:45 PM
Edited Sep 2, 2008 at 2:50 PM
Hi,
i have found out the problem with decompression. It has nothing to do with your or my code. The gzipped content is corrupt even if you let it download by vs2008 sp1 itself. There is missing some bytes on the end of every gzipped source file, so the GZipStream class ran out of content before it can finish decompression. Because of the nature of internal buffering of GZipStream, we get the last unfinished decompressed block only if we call .Read() a last time after we thought it was finished.
I think that the gzipped content is corrupt could be that Microsoft uses on server side .Net Framework with GZipStream to compress this, but they forgot to close the stream. The compression is buffered too and they must close the stream to send the last bytes to the client.
 I have already sent a bug report to this, related to Ajax and PageRequestManager, there is the same problem:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=357565

Best Regards
Aanteus
Sep 8, 2008 at 7:57 AM
Any comments to this?