FlashCap icon indicating copy to clipboard operation
FlashCap copied to clipboard

Avalonia aot 启动失败

Open yangjieshao opened this issue 1 year ago • 1 comments
trafficstars

Avalonia 11.0.9 尝试aot 启动失败

(try aot , failed)

    <PropertyGroup>
        <IlcGenerateMapFile>false</IlcGenerateMapFile>
        <PublishAot>true</PublishAot>
        <PublishTrimmed>true</PublishTrimmed>
        <PublishReadyToRun>true</PublishReadyToRun>
        <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
        <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
        <EnableAotAnalyzer>true</EnableAotAnalyzer>
        <MaxCpuCount Condition="'$(MaxCpuCount)' == ''">0</MaxCpuCount>
    </PropertyGroup>
<Project>
    <ItemGroup>
        <TrimmerRootAssembly Include="FlashCap" />
        <TrimmerRootAssembly Include="FlashCap.Core" />
    </ItemGroup>
</Project>

Log :

COM Interop requires ComWrapper instance registered for marshalling.
System.NotSupportedException
<unknown>
   at System.Runtime.InteropServices.ComWrappers.ComObjectForInterface(IntPtr) + 0x76
   at FlashCap.Internal.NativeMethods_DirectShow.CoCreateInstance(Guid& classId, Object outer, NativeMethods_DirectShow.CLSCTX classContext, Guid& iid, Object& created) + 0xa7
   at FlashCap.Internal.NativeMethods_DirectShow.<EnumerateDeviceMoniker>d__48.MoveNext() + 0x65
   at System.Linq.EnumerableExtension.<Collect>d__0`2.MoveNext() + 0xbf
   at System.Linq.Enumerable.ConcatIterator`1.MoveNext() + 0x5b
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext() + 0x51
   at Jgj.FrontDesk.ViewModels.UsbCameraViewModel..ctor(Int32 defaultDevcieIndex, Int32 defaultVideoResolution, Boolean autoStart) + 0x26a
   at Jgj.FrontDesk.ViewModels.RegisterViewModel..ctor() + 0xc80
   at Jgj.FrontDesk.ViewModels.MainWindowViewModel..ctor() + 0x9d
   at Jgj.FrontDesk.ViewModels.MainWindowViewModel..ctor(CancellationToken cancellationToken) + 0x36
   at Jgj.FrontDesk.App.OnFrameworkInitializationCompleted() + 0xb8
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder, String[], Action`1) + 0x2f
   at Jgj.FrontDesk.Program.Main(String[] args) + 0x547

yangjieshao avatar Feb 29 '24 10:02 yangjieshao

I found some material a while ago that might be relevant to this:.

https://learn.microsoft.com/en-us/dotnet/standard/native-interop/tutorial-comwrappers

In fact, it is unclear at this time whether or not the work can be resolved by doing the work, as we do not know the details of ComWrappers.

kekyo avatar May 29 '25 07:05 kekyo