Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
1a0ff955
Commit
1a0ff955
authored
Dec 02, 2019
by
Sydney Acksman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comment and Assert.DoesNotThrow to RequiredFieldsNoThrow
parent
f084d622
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
GeneratedMessageTest.Proto2.cs
...p/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
+5
-2
No files found.
csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
View file @
1a0ff955
...
...
@@ -261,11 +261,14 @@ namespace Google.Protobuf
Assert
.
True
(
message
.
IsInitialized
());
}
// Code was accidentally left in message parser that threw exceptions when missing required fields after parsing.
// We've decided to not throw exceptions on missing fields, instead leaving it up to the consumer how they
// want to check and handle missing fields.
[
Test
]
public
void
RequiredFieldsNoThrow
()
{
TestRequired
.
Parser
.
ParseFrom
(
new
byte
[
0
]
);
(
TestRequired
.
Parser
as
MessageParser
).
ParseFrom
(
new
byte
[
0
]
);
Assert
.
DoesNotThrow
(()
=>
TestRequired
.
Parser
.
ParseFrom
(
new
byte
[
0
])
);
Assert
.
DoesNotThrow
(()
=>
(
TestRequired
.
Parser
as
MessageParser
).
ParseFrom
(
new
byte
[
0
])
);
}
[
Test
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment