I noticed that LayerFactory.CreateLayer takes huge amount of time to add content of lyr file to a map. On my computer it takes more than 5 minutes to add simple layer (lyr file is attached – TestLayer.lyr).
I created simple test add-in to illustrate the problem (VS solution is attached – TestSlowCreateLayer.zip). Add-in contains the button (named Test slow CreateLayer) which calls
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(new Uri(layerFilePath), MapView.Active.Map));
where layerFilePath is the path of attached lyr file (TestLayer.lyr). After method is executed the message box with execution time will be shown.
I can reproduce this behavior for every lyr file I take. Layer data is very simple as you can see.
Also I noticed high CPU usage for ArcGIS Pro while layer is being created: 70-80%.
CPU Intel Core i5-7200U
8 GB RAM
ArcGIS Pro 2.1
My add-in should work in ArcgIS Pro 2.1 so I need to get it work good on this version. I suppose 5 minutes for provided lyr file is more than it should be.