x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

First Chance Exception Access Violation at reading location

The Exception

In my unreal project I am using an external library (dll) that I have created that has dependencies on C++ REST SDK. I have imported both dlls (for x64) and lib files and set correctly the include paths modifying the build.cs.

When I try to use the function from my external project (that calls on the C++ REST SDK library) the exception is thrown.

I would really appreciate your help with this because I have deadline on Monday and this dlls need to be included in Unreal by then.

Thanks in advance for your time!

Message

Here is the message: alt text

Output

Here is the output from the console:

 [2015.05.13-13.53.08:351][815]PIE: Info Play in editor start time for /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonExampleMap 0.184
 [2015.05.13-13.53.09:896][984]LogBlueprintUserMessages: Test Successful!!
 'UE4Editor.exe' (Win32): Loaded 'C:\Windows\System32\credssp.dll'. Cannot find or open the PDB file.
 [2015.05.13-13.53.10:088][984]LogBlueprintUserMessages: {
   "origin": "122.131.211.193"
 }
 
 First-chance exception at 0x000007FEE3E3D194 (nvwgf2umx.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
 Unhandled exception at 0x000007FEE3E3D194 (nvwgf2umx.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

The logs show that the functions from my classes executed correctly, the IP address is the result of a GET request using the C++ REST SDK library.

Stack

Here is the stack call:

      nvwgf2umx.dll!000007fee3e3d194()    Unknown
      nvwgf2umx.dll!000007fee3eb4519()    Unknown
      [External Code]    
 >    UE4Editor-D3D11RHI.dll!FD3D11DynamicRHI::RHILockVertexBuffer(FRHIVertexBuffer * VertexBufferRHI, unsigned int Offset, unsigned int Size, EResourceLockMode LockMode) Line 111    C++
      UE4Editor-RHI.dll!LockVertexBuffer_Internal(FRHIVertexBuffer * VertexBuffer, unsigned int Offset, unsigned int SizeRHI, EResourceLockMode LockMode) Line 625    C++
      UE4Editor-Engine.dll!FBoneDataVertexBuffer::UnlockData() Line 189    C++
      UE4Editor-Engine.dll!FPreviousPerBoneMotionBlur::UnlockData() Line 1174    C++
      UE4Editor-Renderer.dll!FDeferredShadingSceneRenderer::RenderVelocities(FRHICommandListImmediate & RHICmdList, TRefCountPtr<IPooledRenderTarget> & VelocityRT) Line 678    C++
      UE4Editor-Renderer.dll!FDeferredShadingSceneRenderer::Render(FRHICommandListImmediate & RHICmdList) Line 993    C++
      UE4Editor-Renderer.dll!RenderViewFamily_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneRenderer * SceneRenderer) Line 1118    C++
      UE4Editor-Renderer.dll!TGraphTask<`FRendererModule::BeginRenderingViewFamily'::`12'::EURCMacro_FDrawSceneCommand>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 667    C++
      UE4Editor-Core.dll!FTaskThread::ProcessTasks(int QueueIndex, bool bAllowStall) Line 428    C++
      UE4Editor-Core.dll!FTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 271    C++
      UE4Editor-RenderCore.dll!RenderingThreadMain(FEvent * TaskGraphBoundSyncEvent) Line 282    C++
      UE4Editor-RenderCore.dll!FRenderingThread::Run() Line 404    C++
      UE4Editor-Core.dll!FRunnableThreadWin::Run() Line 73    C++
      UE4Editor-Core.dll!FRunnableThreadWin::GuardedRun() Line 48    C++
      [External Code]    

Blueprint

From the blueprints this is the point where my function is called: alt text

Code

The code of the function that is called in the blueprint is:

Sensor.h

 UCLASS(Blueprintable)
 class PROJECT ASensor: public AActor
 {
     GENERATED_BODY()
     
 public:    
     // Sets default values for this actor's properties
     ASensor();
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     //

Called every frame virtual void Tick( float DeltaSeconds ) override;

 UFUNCTION(BlueprintCallable, Category = "Default")
     FText makeHttpRequest();

};

Sensor.cpp

 FText AGameSensorPresence::makeHttpRequest(){
     SampleRequest sr = SampleRequest();
     std::string text = sr.doRequest();
 
     return FText::FromString(text.c_str());
 }

From the imported libraries there is:

SampleRequest.h

 #include <cpprest\http_client.h>
 #include <cpprest\filestream.h>
 
 using namespace utility;
 using namespace web;
 using namespace web::http;
 using namespace web::http::client;
 using namespace concurrency::streams;
 
 class __declspec(dllexport) SampleRequest
 {
 public:
     SampleRequest(){};
     std::string doRequest();
 };

The includes and the namespaces are all from C++ REST SDK.

SampleRequest.cpp

 std::string SampleRequest::doRequest(){
 
     pplx::task<string_t> mytask = pplx::create_task([]
         {
             http_client client(L"http://httpbin.org/ip");
 
             return client.request(methods::GET);
         }).then([](http_response response)
             {
                 if (response.status_code() == status_codes::OK)
                 {
                     return response.extract_string().get();
                 }
 
                 return utility::string_t();
             });
 
     std::string aux = conversions::to_utf8string(mytask.get());
 
     mytask.wait();
 
     return aux;
 }

Observations

I think the problem comes from here, pplx is a part of the library that is in charge of making asynchronous calls but I have no idea where the conflict with the engine might be.

I built the code in SampleRequest.cpp following this tutorial. Specifically the part where he creates the function pplx::task GetAll().

Please help! Thank you very much for your time!

Product Version: Not Selected
Tags:
message.png (28.4 kB)
blueprint.png (62.4 kB)
more ▼

asked May 13 '15 at 02:15 PM in C++ Programming

avatar image

Strauzen
70 9 10 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

The library that I use is using lambda expressions, I believe this is not supported in Unreal Engine and thus this is the reason I get the exception.

I found some related comments here.

Could someone please confirm?

more ▼

answered May 14 '15 at 07:32 AM

avatar image

Strauzen
70 9 10 18

avatar image Mtimofeev Dec 23 '15 at 08:33 PM

Have you found any solution? I am having the same issue with another 3rd pary library (ifcengine.dll)

avatar image Strauzen Jul 17 '17 at 04:36 PM

The reply comes way too late but better late than never. In the end I gave up on the C++ implementation and moved on to make my project using blueprints only. In other words I never found a solution for this.

avatar image sgkz Oct 19 '17 at 09:04 AM

Bumped into this today and problem seems in

task.wait()

I'm now trying to make an UWP app with UE4 and if I use wait() the Engine will immediately shutting down.. Hope someone get solution!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question