Compilation Error due to 'MessageOptions' Type Conflict between 'Google.Protobuf' and 'WireMock.Net' #585

Closed
opened 2025-12-29 15:27:39 +01:00 by adam · 6 comments
Owner

Originally created by @iamzhaoxu on GitHub (Mar 11, 2024).

Originally assigned to: @StefH on GitHub.

Describe the bug

During the compilation of my project, an error arises because of a type conflict involving 'MessageOptions' originating from two distinct libraries: 'Google.Protobuf' and 'protobuf-net.Reflection'.

The project references both 'WireMock.Net' and 'Google.Protobuf'. Upon updating both libraries to version 1.5.49 for 'WireMock.Net' and version 3.25.3 for 'Google.Protobuf', this compilation error surfaces. The conflict emerges as 'WireMock.Net' starts utilizing 'protobuf-net.Reflection', thereby resulting in the existence of the 'MessageOptions' class within the same namespace in both libraries.

Expected behavior:

Compilation should proceed without errors, ensuring the successful build of the project.

Test to reproduce

Ensure project references 'WireMock.Net' and 'Google.Protobuf'.
Update 'WireMock.Net' to version 1.5.49 and 'Google.Protobuf' to version 3.25.3.
Attempt to compile the project.
Encounter the error message due to the type conflict with 'MessageOptions'.
Screenshot 2024-03-11 110549

Originally created by @iamzhaoxu on GitHub (Mar 11, 2024). Originally assigned to: @StefH on GitHub. ### Describe the bug During the compilation of my project, an error arises because of a type conflict involving 'MessageOptions' originating from two distinct libraries: 'Google.Protobuf' and 'protobuf-net.Reflection'. The project references both 'WireMock.Net' and 'Google.Protobuf'. Upon updating both libraries to version 1.5.49 for 'WireMock.Net' and version 3.25.3 for 'Google.Protobuf', this compilation error surfaces. The conflict emerges as 'WireMock.Net' starts utilizing 'protobuf-net.Reflection', thereby resulting in the existence of the 'MessageOptions' class within the same namespace in both libraries. ### Expected behavior: Compilation should proceed without errors, ensuring the successful build of the project. ### Test to reproduce Ensure project references 'WireMock.Net' and 'Google.Protobuf'. Update 'WireMock.Net' to version 1.5.49 and 'Google.Protobuf' to version 3.25.3. Attempt to compile the project. Encounter the error message due to the type conflict with 'MessageOptions'. ![Screenshot 2024-03-11 110549](https://github.com/WireMock-Net/WireMock.Net/assets/1594894/16a8ad36-e840-4911-9428-e7e8831fcd2d)
adam added the bug label 2025-12-29 15:27:39 +01:00
adam closed this issue 2025-12-29 15:27:40 +01:00
Author
Owner

@StefH commented on GitHub (Mar 20, 2024):

@iamzhaoxu

Can you please provide an example project?

Because I cannot reproduce this problem. I also have a unit test project which uses both:

@StefH commented on GitHub (Mar 20, 2024): @iamzhaoxu Can you please provide an example project? Because I cannot reproduce this problem. I also have a unit test project which uses both: - https://github.com/WireMock-Net/WireMock.Net/tree/master/test/WireMock.Net.Tests
Author
Owner

@StefH commented on GitHub (Apr 2, 2024):

@iamzhaoxu
Can you please provide an example project ?

@StefH commented on GitHub (Apr 2, 2024): @iamzhaoxu Can you please provide an example project ?
Author
Owner

@StefH commented on GitHub (May 13, 2024):

@iamzhaoxu
Can you please provide an example project which shows this issue?

@StefH commented on GitHub (May 13, 2024): @iamzhaoxu Can you please provide an example project which shows this issue?
Author
Owner

@iamzhaoxu commented on GitHub (May 27, 2024):

@StefH I'm sorry for not getting back to you sooner. I forgot this thread.
The sample code below can trigger the issue
ConsoleApp1.zip
Once you build the solution, you will see the error.

Also, I asked the same question in this thread as well and this is for your reference https://github.com/protobuf-net/protobuf-net/issues/1137

@iamzhaoxu commented on GitHub (May 27, 2024): @StefH I'm sorry for not getting back to you sooner. I forgot this thread. The sample code below can trigger the issue [ConsoleApp1.zip](https://github.com/WireMock-Net/WireMock.Net/files/15452346/ConsoleApp1.zip) Once you build the solution, you will see the error. Also, I asked the same question in this thread as well and this is for your reference https://github.com/protobuf-net/protobuf-net/issues/1137
Author
Owner

@StefH commented on GitHub (May 5, 2025):

https://github.com/WireMock-Net/WireMock.Net/pull/1291

@StefH commented on GitHub (May 5, 2025): https://github.com/WireMock-Net/WireMock.Net/pull/1291
Author
Owner

@StefH commented on GitHub (May 6, 2025):

@iamzhaoxu
Please upgrade to 1.8.2

@StefH commented on GitHub (May 6, 2025): @iamzhaoxu Please upgrade to 1.8.2
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#585