Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] EventProcessorHost TypeLoadException #7305

Closed
SteffenMangold opened this issue Aug 16, 2019 · 12 comments
Closed

[BUG] EventProcessorHost TypeLoadException #7305

SteffenMangold opened this issue Aug 16, 2019 · 12 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs Service Attention This issue is responsible by Azure service team.
Milestone

Comments

@SteffenMangold
Copy link

Describe the bug
A TypeLoadException is thrown for 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' when using EventProcessorHost.

Exception or Stack Trace

           at Microsoft.Azure.EventHubs.Processor.AzureStorageCheckpointLeaseManager..ctor(String storageConnectionString, String leaseContainerName, String storageBlobPrefix)

at Microsoft.Azure.EventHubs.Processor.EventProcessorHost..ctor(String eventHubPath, String consumerGroupName, String eventHubConnectionString, String storageConnectionString, String leaseContainerName)
at Solytic.Services.DataReadingHostService.Program.Main(String[] args) in C:\Users\SteffenMangold\source\repos\Solytic 2.0 Backend Services\Solytic.Services.DataReadingHostService\Program.cs:line 16

To Reproduce

        <Project Sdk="Microsoft.NET.Sdk">
          <PropertyGroup>
            <OutputType>Exe</OutputType>
            <TargetFramework>netcoreapp2.2</TargetFramework>
            <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
          </PropertyGroup>

          <ItemGroup>
            <PackageReference Include="Microsoft.Azure.EventHubs" Version="4.0.0" />
            <PackageReference Include="Microsoft.Azure.EventHubs.Processor" Version="4.0.0" />
            <PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.0.0" />
            <PackageReference Include="Microsoft.Azure.Storage.Common" Version="11.0.0" />                
            <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.2" />
          </ItemGroup>
        </Project>

Code Snippet

        EventProcessorHost eventProcessorHost = new EventProcessorHost("test"
            , "Event Hubs"
            , "Consumer1"
            , AzureEventHubsModel.GetDefaultConnectionString()
            , string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", "lease", "QZPDA8ZOTW1ndnTArwqSFlflnR3P8vOdCifSj5sEEJP/MGEM1fmYOsJRKgZWZuaSClOyobTunGT8kqDAMWRjVg=="))
        {
            PartitionManagerOptions = new PartitionManagerOptions()
            {
                RenewInterval = TimeSpan.FromSeconds(10),
                LeaseDuration = TimeSpan.FromSeconds(60)
            }
        };

Setup (please complete the following information):

  • OS: Windows 10
  • IDE : VS2019

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ x] Bug Description Added
  • [ x] Repro Steps Added
  • [ x] Setup information Added
@triage-new-issues triage-new-issues bot added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 16, 2019
@SteffenMangold
Copy link
Author

SteffenMangold commented Aug 16, 2019

Downgrade "Microsoft.Azure.EventHubs.Processor" to 3.0.0 solves the problem.
Helps only with IntelliSens error, still not usable. (See above for details)

@loarabia loarabia added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hub Event Hubs Service Attention This issue is responsible by Azure service team. labels Aug 16, 2019
@triage-new-issues triage-new-issues bot removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 16, 2019
@ghost
Copy link

ghost commented Aug 16, 2019

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl

1 similar comment
@ghost
Copy link

ghost commented Aug 16, 2019

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl

@SteffenMangold
Copy link
Author

This is the source of the problem.
image

@SteffenMangold
Copy link
Author

SteffenMangold commented Aug 17, 2019

It looks like the problem is related to the "Microsoft.Azure.Storage.Blob" library.
NETStandard and NETCore version is using a different namespace.

But I can't patch it because n the current branch there is no CloudStorageAccount class!?
I don't get it. :(

@SteffenMangold
Copy link
Author

SteffenMangold commented Aug 20, 2019

Any news on this? Because in relation with NetCore and "Microsoft.Azure.EventHubs" the EventProcessorHost is not useable in any version.

Version 3.0.0 throws:
Method not found: 'Microsoft.Azure.EventHubs.EventHubClient Microsoft.Azure.EventHubs.EventHubClient.Create(System.Uri, System.String, Microsoft.Azure.EventHubs.ITokenProvider, System.Nullable'1<System.TimeSpan>, Microsoft.Azure.EventHubs.TransportType)'.

Stack:

at Microsoft.Azure.EventHubs.Processor.EventProcessorHost.CreateEventHubClient()
 at Microsoft.Azure.EventHubs.Processor.PartitionManager.<GetPartitionIdsAsync>d__6.MoveNext()

Currently, we can't develop any further! @jfggdl

@SteffenMangold
Copy link
Author

This is a random post - I have 3.0.0 working (had same issue as you with 4.0.0)
When going from 2.?.? -> 3.0.0 I had issue with:

// Azure/azure-event-hubs-dotnet#383
// hostName: Program.ServiceInstanceName,
hostName: Program.ServiceInstanceName + "" + DateTimeOffset.Now.ToDateTimeString().Replace(" ", ""),

I think azure uses GUID:s for hostname (or that is their test case) - but my memory might be corrupted as its to long ago

Can you share what version of Microsoft.Azure.EventHubs you are using and what overload of EventProcessorHost constructor? Because I wonder why I can't run 3.0.0!?

@larslarsson
Copy link

larslarsson commented Aug 21, 2019

That problem doesn't seem to exist anymore, should have tested.
Ah you run .net core, hade exact same error on .net framework

<package id="Microsoft.Azure.EventHubs" version="3.0.0" targetFramework="net462" />
<package id="Microsoft.Azure.EventHubs.Processor" version="3.0.0" targetFramework="net462" />

I used IEventProcessorFactory but I do not remember why nor do I remember the documentation anymore :(

                var listenerEventHubFactory = new Models.Listeners.ListenerEventHubProcessFactory(listenerMulti, eventHubCfg);
                var host = new Microsoft.Azure.EventHubs.Processor.EventProcessorHost(
                    hostName: Program.ServiceInstanceName + "_" + DateTimeOffset.Now.ToDateTimeString().Replace(" ", "_"),
                    eventHubPath: EventHubSettings.Default.HubName,
                    consumerGroupName: EventHubSettings.Default.ConsumerGroup,
                    eventHubConnectionString: EventHubSettings.Default.Connection,
                    storageConnectionString: EventHubSettings.Default.StorageConnection,
                    leaseContainerName: EventHubSettings.Default.HubName
                );
                listenerStartables.Add(new Data.DelegateStartable(() => host.RegisterEventProcessorFactoryAsync(listenerEventHubFactory, options)));

@SteffenMangold
Copy link
Author

SteffenMangold commented Aug 21, 2019

@larslarsson but is your core application Net standard or Net core?
Also I think its important if you already using Microsoft.Azure.Storage.Blob or the old WindowsAzure.Storage library. I think the dependency of both somehow not work beside.

Ok! get it working by also reverting Microsoft.Azure.EventHubs to 3.0.0.

@larslarsson
Copy link

Good for you - and yes I was wrong in that I use .net framework as base not .net core or .net standard.

Was thinking I had to go to my shame corner & cry since shelvset worked after rebuild but closing VS2019 & reopen it & rebuilding gives me the exception again.

.net framework 4.6.2
2019-08-21 17:53:00,009 [1 ] FATAL (Program) - UnhandledExceptionEventArgs: at Microsoft.Azure.EventHubs.Processor.AzureStorageCheckpointLeaseManager..ctor(String storageConnectionString, String leaseContainerName, String storageBlobPrefix)
at Microsoft.Azure.EventHubs.Processor.EventProcessorHost..ctor(String hostName, String eventHubPath, String consumerGroupName, String eventHubConnectionString, String storageConnectionString, String leaseContainerName, String storageBlobPrefix)

2019-08-21 17:53:00,011 [1 ] FATAL (Program) - UnhandledExceptionEventArgs, message:Could not load type 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' from assembly 'Microsoft.Azure.Storage.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

@axisc
Copy link

axisc commented Aug 21, 2019

@SteffenMangold

Thanks for raising this issue. We identified that one of the libraries we depend modified the contract.

We will update the dependency in the next release (4.1), which should solve the problem on your end.

I'll keep this issue open until then.

@axisc axisc added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Aug 21, 2019
@jsquire jsquire removed the Event Hub label Aug 21, 2019
@axisc axisc added this to the Sprint 159 milestone Aug 23, 2019
@serkantkaraca
Copy link
Member

The failure was due to storage namespace change from 9.4 to 11.0. Issue fixed with EPH 4.1.0 release. Please reactivate if needed.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

7 participants