Duplicating a Level in Development configuration crashes exe

I tried duplicating a level using

ULevel* DuplicateLevel = DuplicateObject(TileLevel, World, TEXT("Duplicate"));

It seems to work fine in the DevelopmentEditor build in the editor but when I run it in a Development build it crashes.
I have added the call stack here as well

Call Stack:

CarProject.exe!FMsg::Logf__VA(const char * File, int Line, const FName & Category, ELogVerbosity::Type Verbosity, const wchar_t * Fmt, …) Line 544 C++
CarProject.exe!UReflectionCaptureComponent::Serialize(FArchive & Ar) Line 848 C++
CarProject.exe!StaticDuplicateObjectEx(FObjectDuplicationParameters & Parameters) Line 1478 C++
CarProject.exe!StaticDuplicateObject(const UObject * SourceObject, UObject * DestOuter, const wchar_t * DestName, EObjectFlags FlagMask, UClass * DestClass, EDuplicateForPie DuplicateForPIE) Line 1376 C++
CarProject.exe!ACarProjectPlayerController::BeginPlay() Line 32 C++

Hey -

Are you still experiencing this bug in the latest version of the engine? In which file are you including the line of code you posted above? Does the crash occur when you compile the code in visual studios or when you try to play the level through the editor? The more information you can provide the easier it will be to reproduce and track the problem.

Cheers

Hi ,
I am still facing the problem in 4.6. I call the function from BeginPlay() function of the player controller.

   FString levelUrl = "World'/Game/Maps/levelname.levelname'";
    UWorld* MainWorld = Cast<UWorld>(StaticLoadObject(UWorld::StaticClass(), NULL, *levelUrl));
    
    ULevel * level = MainWorld->PersistentLevel;
    
    ULevel* DuplicateLevel = DuplicateObject<ULevel>(level, m_world, TEXT("Duplicate"));

the m_world is simply a pointer to the current loaded world. I can use the level varaible for most of what I need currently. But I was just wondering why I cant duplicate it.

Hey -

Sorry for the delayed response. I’m still trying to reproduce your crash but have not been successful yet. Could you post the log files from the crash to help determine what the cause may be?

Also, just as a safety check, does the crash occur in any configuration other than development?

Hi ,

The problem doesnt occur in the editor builds. For non editor builds the problem persists.
For recreating this on your side, I would ask you to run a Non-Editor build on your visual studio and try to use DuplicateObject or StaticDuplicateObject on a ULevel pointer to create duplicates of it.Since the crash occurs in the non-Editor version there are no logs. And I have already attached the call stack.

Hey -

I apologize for the delayed response. We are still investigating this however I’d like to ask if you are still experiencing this issue in the latest version of the engine. If this is still a problem would it be possible for you to send us a copy of your project or post the code class where you are setting up the duplicate level?

Cheers

Hi ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.