CreateBlendState1 Error - .NET 5.0 not supported.
h1cks opened this issue · 9 comments
Updated my project to the latest vortice, CreateBlendState1 is throwing an error
Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Stack trace is
at Vortice.Direct3D11.BlendDescription1.__MarshalTo(__Native& ref) at Vortice.Direct3D11.ID3D11Device1.CreateBlendState1(BlendDescription1 blendStateDesc) at GraphicsCore.Insane3d.BlendStateList.AddState(ID3D11Device1 d3dDevice, String key, BlendDescription1 desc) in E:\Development\Pacific Strafe\GraphicsCore\Code\BlendStateList.cs:line 34 at Insane3D.RenderManager.CreateBlendStates(ID3D11Device1 d3dDevice) in E:\Development\Pacific Strafe\Pacific Strafe\Code\Core Classes\Managers\RenderManager.Configuration.cs:line 44 at Insane3D.RenderManager.InitialSetup(ID3D11Device1 d3dDevice, ID3D11DeviceContext1 deviceContext, GameManagerContainer gameManagerContainer, DirectXContainer directXContainer) in E:\Development\Pacific Strafe\Pacific Strafe\Code\Core Classes\Managers\RenderManager.cs:line 232 at Strafe.GameApplication.PreIntroGameData() in E:\Development\Pacific Strafe\Pacific Strafe\Code\Strafe Game Logic\GameApplication.GameStates.cs:line 482 at Strafe.GameApplication.ImmediateLevelDebug(ID3D11Device1 D3Ddevice) in E:\Development\Pacific Strafe\Pacific Strafe\Code\Strafe Game Logic\GameApplication.GameStates.cs:line 55 at Strafe.GameApplication.ApplicationMainLoop(ID3D11Device1 D3Ddevice) in E:\Development\Pacific Strafe\Pacific Strafe\Code\Strafe Game Logic\GameApplication.GameStates.cs:line 118 at Strafe.GameApplication.RenderCallback() in E:\Development\Pacific Strafe\Pacific Strafe\Code\Strafe Game Logic\GameApplication.GameStates.cs:line 44 at Insane3D.RenderLoop.Run(Control form, RenderCallback renderCallback, Boolean useApplicationDoEvents) in E:\Development\Pacific Strafe\Pacific Strafe\Code\Core Classes\Helpers\RenderLoop.cs:line 198 at Strafe.Program.Main(String[] args) in E:\Development\Pacific Strafe\Pacific Strafe\Code\Program.cs:line 83
The blendstate I created was:
BlendDescription1 blendStateDescription_;
blendStateDescription_ = new BlendDescription1()
{
AlphaToCoverageEnable = false
};
blendStateDescription_.RenderTarget[0].IsBlendEnabled = true;
blendStateDescription_.RenderTarget[0].SourceBlend = Blend.SourceAlpha;
blendStateDescription_.RenderTarget[0].DestinationBlend = Blend.InverseSourceAlpha; //
blendStateDescription_.RenderTarget[0].BlendOperation = D3D11.BlendOperation.Add;
blendStateDescription_.RenderTarget[0].SourceBlendAlpha = Blend.One; //Zero
blendStateDescription_.RenderTarget[0].DestinationBlendAlpha = Blend.Zero;
blendStateDescription_.RenderTarget[0].BlendOperationAlpha = D3D11.BlendOperation.Add;
blendStateDescription_.RenderTarget[0].RenderTargetWriteMask = ColorWriteEnable.All;
Will close is this is a usage issue.
Not sure what CompilerServices.Unsafe has to do with the issue, make sure you can create and example application so I can reproduce it
I am running under .net 5.
Might up to 6.
@amerkoleci Update: Moving from .NET 5 to 6 fixed it.
@amerkoleci found the issue, I was running under .NET 5.0
The __MarshalTo looks like a .NET 6.0 function. I checked the stack and found "Feature not supported" on that function.
Issue is .net 5.0 vs .net 6.0. Simply compiling my game under .net 5.0 I could reproduce.
The current targets are netstandard 2.0 and net 6.0. Idk if net 5.0 would try to use the netstandard library. Upgrading may be the best path.
The current targets are netstandard 2.0 and net 6.0. Idk if net 5.0 would try to use the netstandard library. Upgrading may be the best path.
Totally agree
I will update. More an issue of whether it can enforced minimum version of .net
I remember facing this issue with .NET and I just had to upgrade the package System.Runtime.CompilerServices.Unsafe to ver.6.