locked
File Access Sample

    Question

  • Hello,

    I have compiled and run the File Access Sample. When I run the sample I am able to read and write to the file correctly, however, I seem to be getting exceptions as shown in the debug window.

    First-chance exception at 0x75AA1D4D (KernelBase.dll) in FileAccess.Windows.exe: 0x40080201: WinRT originate error (parameters: 0x80004001, 0x00000011, 0x0571F1EC).

    The exceptions seems to be coming from the following lines of the sample code:

    create_task(FileIO::ReadBufferAsync(file)).then([this],file](task<IBuffer^> task)

    create_task(FileIO::WriteBufferAsync(file, buffer)).then([this, file, buffer, userContent](task<void> task)

    The ReadTextAsync and WriteTextAsync calls also produce similar exceptions.

    I am compiling and running the File Access sample app without any modifications on VS 2013.

    Why am I receiving the exceptions?

    Thanks.


    • Edited by amukherjee Thursday, August 14, 2014 7:53 AM
    Thursday, August 14, 2014 7:47 AM

Answers

  • Thanks for your information, and finally I can reproduce the issue.

    I would like to share what is "First Chance Exception" before trying to reply the question.

    First Chance Exception does not often mean you have problem with the code, the message delivered to you means an exceptional situation was encountered and was handled. Actually we do not need care much about such exception because system already handle them for us. See the blog for more information: http://blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx

    If the first chance exception cannot be handled by system, the second-chance exception will be thrown for user to handle, and this is what we can see from debugger.

    Anyway, don't worry about the first chance exception, system will help you manage them.

    Some additional information:

    #1 if you want to handle the exception manually, you could set select "Win32 Exception" in Debug->Exception panel and use try-catch to manage the exception:

    #2, if you do not want to see such information from output panel, you could modify the output setting from Tools->Option:

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 04, 2014 3:30 AM
    Moderator

All replies

  • Hi amukerjee,

    First chance exception messages most often do not mean there is a problem in the code, but instead there must be something wrong with your environment while running the sample.

    Here are some suggestions that we can follow to see if we can fix the situation.

    1, Restart everything include the operation system, and clean the solution, then try to debug the app again.

    2, Create a new C++ blank app to debug to test if the problem is on your Visual Studio.

    3, Repair the Visual Studio in Control Panel, let's see if the fix can help you.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 15, 2014 8:50 AM
    Moderator
  • Hi James,

    Thanks for the response. I have tried what you suggested. I have VS 2013 on multiple machines and getting the same exception from this sample on all machines.

    I have some code implemented in my app similar to the sample and getting the exception in my code as well.

    If you compile and run the code at your end, do you get the same error?

    Regarding the parameters on the error code, I believe the 0x80004001 code means NOT_IMPL, I am at a loss at to where it could be coming from.

    Thanks.

    Friday, August 15, 2014 5:30 PM
  • Hi amukerjee,

    I download the project and test on my machine, but everything is ok, may I know what is your Visual Studio 2013 version, and which update you have applied, a RC update or a RTM update?

    I would like to share my environment with you, Windows 8.1 + Visual Studio 2013 Ultimate with Update 2 patched. Works fine with File Access Sample C++.

    The 0x80004001 in documentation from Common HRESULT Values means "Not implemented", I don't know if the Visual Studio you installed in your test machine comes from one source? Looks like the error comes from your environment. Test with another sample to see if the same thing happen?

    --James

     


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 19, 2014 9:00 AM
    Moderator
  • Hi James,

    Thanks for the response again. I was getting this exception with VS2013 Update 2, since then I have applied Update 3 and am still receiving the exception. Below are my visual studio details:

    Microsoft Visual Studio Professional 2013
    Version 12.0.30723.00 Update 3
    Microsoft .NET Framework
    Version 4.5.51641

    I had downloaded VS2013 /w Update 2 through my MSDN professional account and then applied Update 3. Both my test machines have VS2013 from the above source and both show this problem.

    Should I download a different version of VS2013? I will see if I have access to the Ultimate version through my MSDN account.

    Thanks.

    Wednesday, August 20, 2014 5:17 AM
  • Hi amukerjee,

    No idea why you get such problem, but it works fine with my side. I would recommend you download a VS2013 copy from following link to see if the same problem exist: http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.



    Monday, August 25, 2014 2:55 AM
    Moderator
  • Hi James,

    Thanks for the response again. I have downloaded the Visual Studio 2013 Ultimate from the link you provided. I uninstalled my VS2013 professional installation and installed the VS 2013 ultimate version.

    When I run the File Access Sample I still get the exceptions on the calls I had mentioned earlier.

    First-chance exception at 0x751F1D4D (KernelBase.dll) in FileAccess.Windows.exe: 0x40080201: WinRT originate error (parameters: 0x80004001, 0x00000011, 0x04B8F868).

    Note that the debugger does not break on these exceptions, and code seems to run fine. They seem to be soft exceptions or are being handled elsewhere. If you look at the output debug window you will see them.

    Thanks.

    Monday, September 01, 2014 6:35 AM
  • Thanks for your information, and finally I can reproduce the issue.

    I would like to share what is "First Chance Exception" before trying to reply the question.

    First Chance Exception does not often mean you have problem with the code, the message delivered to you means an exceptional situation was encountered and was handled. Actually we do not need care much about such exception because system already handle them for us. See the blog for more information: http://blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx

    If the first chance exception cannot be handled by system, the second-chance exception will be thrown for user to handle, and this is what we can see from debugger.

    Anyway, don't worry about the first chance exception, system will help you manage them.

    Some additional information:

    #1 if you want to handle the exception manually, you could set select "Win32 Exception" in Debug->Exception panel and use try-catch to manage the exception:

    #2, if you do not want to see such information from output panel, you could modify the output setting from Tools->Option:

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 04, 2014 3:30 AM
    Moderator
  • James,

    Thanks for the information and your persistence!

    Regards,

    amukhejree

    Sunday, September 07, 2014 4:49 PM
  • Hi amukerjee,

    I will close this thread, if you still have question, please feel free to post on the forum.

    Thanks for your understanding.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, September 16, 2014 6:28 AM
    Moderator